[−][src]Trait asn1_der::traits::FromDerEncoded
A trait to parse DER-encoded data into a typed representation
Required methods
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
Decodes some DER-encoded data and converts them into Self
Parameters:
data
: The DER-encoded data to parse and to convert intoSelf
Returns either the successfully parsed object or on error:
Asn1DerError::NotEnoughBytes
if the overall length is zero, the length-field is too short or the payload is shorter than the annotated lengthAsn1DerError::InvalidEncoding
if the length-field is invalid or if the encoded type does not conform to the DER-encoding rulesAsn1DerError::Unsupported
if the length is greater thanstd::usize::MAX
or if the encoded object is unsupported by this implementation (e.g. an integer that is too large)Asn1DerError::InvalidTag
if the tag annotates an incompatible type
fn with_der_encoded(data: &[u8]) -> Result<Self>
Decodes some DER-encoded data and converts them into Self
Warning: During the parsing we'll create a copy of the payload. However, the copying
happens only if the object is valid and will be parsed to a DerObject
and the copy
includes only the payload (and not any other remaining data).
Parameters:
data
: The DER-encoded data to parse and to convert intoSelf
Returns either the successfully parsed object or on error:
Asn1DerError::NotEnoughBytes
if the overall length is zero, the length-field is too short or the payload is shorter than the annotated lengthAsn1DerError::InvalidEncoding
if the length-field is invalid or if the encoded type does not conform to the DER-encoding rulesAsn1DerError::Unsupported
if the length is greater thanstd::usize::MAX
or if the encoded object is unsupported by this implementation (e.g. an integer that is too large)Asn1DerError::InvalidTag
if the tag annotates an incompatible type
Implementations on Foreign Types
impl FromDerEncoded for ()
[src]
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
[src]
fn with_der_encoded(data: &[u8]) -> Result<Self>
[src]
impl FromDerEncoded for bool
[src]
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
[src]
fn with_der_encoded(data: &[u8]) -> Result<Self>
[src]
impl FromDerEncoded for Vec<u8>
[src]
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
[src]
fn with_der_encoded(data: &[u8]) -> Result<Self>
[src]
impl FromDerEncoded for String
[src]
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
[src]
fn with_der_encoded(data: &[u8]) -> Result<Self>
[src]
impl FromDerEncoded for u64
[src]
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
[src]
fn with_der_encoded(data: &[u8]) -> Result<Self>
[src]
impl<T> FromDerEncoded for Vec<T> where
T: FromDerObject,
[src]
T: FromDerObject,
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
[src]
fn with_der_encoded(data: &[u8]) -> Result<Self>
[src]
Implementors
impl FromDerEncoded for DerObject
[src]
fn from_der_encoded(data: Vec<u8>) -> Result<Self>
[src]
Create a Generic
-object from DER-encoded data
Parameters:
data
: The DER-encoded data to parse
Returns either the successfully parsed object or on error:
Asn1DerError::NotEnoughBytes
if the overall length is zero, the length-field is too short or the payload is shorter than the annotated lengthAsn1DerError::InvalidEncoding
if the length-field is invalidAsn1DerError::Unsupported
if the length is greater thanstd::usize::MAX
fn with_der_encoded(data: &[u8]) -> Result<Self>
[src]
Create a Generic
-object by decoding the DER-encoded data
Warning: The resulting object will contain a copy of the payload. However, the copying happens only if the object is valid and will be parsed and the copy includes only the payload (and not any other remaining data).
Parameters:
data
: The DER-encoded data to parse; the data may be longer than the object
Returns either the successfully parsed object or on error:
Asn1DerError::NotEnoughBytes
if the overall length is zero, the length-field is too short or the payload is shorter than the annotated lengthAsn1DerError::InvalidEncoding
if the length-field is invalidAsn1DerError::Unsupported
if the length is greater thanstd::usize::MAX