Struct x509_parser::certificate::X509CertificateParser
source · pub struct X509CertificateParser { /* private fields */ }
Expand description
X.509 Certificate parser
This object is a parser builder, and allows specifying parsing options.
Currently, the only option is to control deep parsing of X.509v3 extensions:
a parser can decide to skip deep-parsing to be faster (the structure of extensions is still
parsed, and the contents can be parsed later using the from_der
method from individual extension objects).
This object uses the nom::Parser
trait, which must be imported.
§Example
To parse a certificate without parsing extensions:
use x509_parser::certificate::X509CertificateParser;
use x509_parser::nom::Parser;
// create a parser that will not parse extensions
let mut parser = X509CertificateParser::new()
.with_deep_parse_extensions(false);
let res = parser.parse(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),
}
Implementations§
source§impl X509CertificateParser
impl X509CertificateParser
pub const fn new() -> Self
pub const fn with_deep_parse_extensions( self, deep_parse_extensions: bool, ) -> Self
Trait Implementations§
source§impl Clone for X509CertificateParser
impl Clone for X509CertificateParser
source§fn clone(&self) -> X509CertificateParser
fn clone(&self) -> X509CertificateParser
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for X509CertificateParser
impl Debug for X509CertificateParser
source§impl<'a> Parser<&'a [u8], X509Certificate<'a>, X509Error> for X509CertificateParser
impl<'a> Parser<&'a [u8], X509Certificate<'a>, X509Error> for X509CertificateParser
source§fn parse(
&mut self,
input: &'a [u8],
) -> IResult<&'a [u8], X509Certificate<'a>, X509Error>
fn parse( &mut self, input: &'a [u8], ) -> IResult<&'a [u8], X509Certificate<'a>, X509Error>
A parser takes in input type, and returns a
Result
containing
either the remaining input and the output value, or an errorsource§fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>
fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>
Creates a second parser from the output of the first one, then apply over the rest of the input
source§fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>
fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>
Applies a second parser over the output of the first one
source§fn and<G, O2>(self, g: G) -> And<Self, G>
fn and<G, O2>(self, g: G) -> And<Self, G>
Applies a second parser after the first one, return their results as a tuple
impl Copy for X509CertificateParser
Auto Trait Implementations§
impl Freeze for X509CertificateParser
impl RefUnwindSafe for X509CertificateParser
impl Send for X509CertificateParser
impl Sync for X509CertificateParser
impl Unpin for X509CertificateParser
impl UnwindSafe for X509CertificateParser
Blanket Implementations§
source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)