Skip to main content

Crate spki

Crate spki 

Source
Expand description

§RustCrypto: X.509 Subject Public Key Info (SPKI)

crate Docs Build Status Apache2/MIT licensed Rust Version Project Chat

X.509 Subject Public Key Info types describing public keys as well as their associated AlgorithmIdentifiers (i.e. OIDs).

Specified in RFC 5280 § 4.1.

Documentation

§Minimum Supported Rust Version (MSRV) Policy

MSRV increases are not considered breaking changes and can happen in patch releases.

The crate MSRV accounts for all supported targets and crate feature combinations, excluding explicitly unstable features.

§License

Licensed under either of:

at your option.

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

§Usage

The following example demonstrates how to use an OID as the parameters of an AlgorithmIdentifier.

Borrow the ObjectIdentifier first then use der::AnyRef::from or .into():

use spki::{AlgorithmIdentifier, ObjectIdentifier};

let alg_oid = "1.2.840.10045.2.1".parse::<ObjectIdentifier>().unwrap();
let params_oid = "1.2.840.10045.3.1.7".parse::<ObjectIdentifier>().unwrap();

let alg_id = AlgorithmIdentifier {
    oid: alg_oid,
    parameters: Some(params_oid)
};

Structs§

AlgorithmIdentifier
X.509 AlgorithmIdentifier as defined in RFC 5280 Section 4.1.1.2.
Document
ASN.1 DER-encoded document.
ObjectIdentifier
Object identifier (OID).
SubjectPublicKeyInfo
X.509 SubjectPublicKeyInfo (SPKI) as defined in RFC 5280 § 4.1.2.7.

Enums§

Error
Error type

Traits§

AssociatedAlgorithmIdentifier
Returns AlgorithmIdentifier associated with the structure.
DecodePublicKey
Parse a public key object from an encoded SPKI document.
DynAssociatedAlgorithmIdentifier
Returns AlgorithmIdentifier associated with the structure.
DynSignatureAlgorithmIdentifier
Returns AlgorithmIdentifierOwned associated with the signature system.
EncodePublicKey
Serialize a public key object to a SPKI-encoded document.
SignatureAlgorithmIdentifier
Returns AlgorithmIdentifier associated with the signature system.
SignatureBitStringEncoding
Returns the BitString encoding of the signature.

Type Aliases§

AlgorithmIdentifierOwned
AlgorithmIdentifier reference which has Any parameters.
AlgorithmIdentifierRef
AlgorithmIdentifier reference which has AnyRef parameters.
AlgorithmIdentifierWithOid
AlgorithmIdentifier with ObjectIdentifier parameters.
Result
Result type with spki crate’s Error type.
SubjectPublicKeyInfoOwned
SubjectPublicKeyInfo with Any algorithm parameters, and BitString params.
SubjectPublicKeyInfoRef
SubjectPublicKeyInfo with AnyRef algorithm parameters, and BitStringRef params.