Trait x509_parser::traits::FromDer [−][src]
Expand description
Parse a DER-encoded object, and return the remaining of the input and the built object.
The returned object uses zero-copy, and so has the same lifetime as the input.
Note that only parsing is done, not validation (see the Validate
trait).
Example
To parse a certificate and print the subject and issuer:
let res = X509Certificate::from_der(DER);
match res {
Ok((_rem, x509)) => {
let subject = x509.subject();
let issuer = x509.issuer();
println!("X.509 Subject: {}", subject);
println!("X.509 Issuer: {}", issuer);
},
_ => panic!("x509 parsing failed: {:?}", res),
}
Required methods
Implementors
CertificationRequest ::= SEQUENCE { certificationRequestInfo CertificationRequestInfo, signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }}, signature BIT STRING }
CertificationRequestInfo ::= SEQUENCE { version INTEGER { v1(0) } (v1,...), subject Name, subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }}, attributes [0] Attributes{{ CRIAttributes }} }
Extension ::= SEQUENCE { extnID OBJECT IDENTIFIER, critical BOOLEAN DEFAULT FALSE, extnValue OCTET STRING }
CertificateList ::= SEQUENCE { tbsCertList TBSCertList, signatureAlgorithm AlgorithmIdentifier, signatureValue BIT STRING }