mtls
only.Expand description
The Any
object is not strictly an ASN.1 type, but holds a generic description of any object
that could be encoded.
It contains a header, and either a reference to or owned data for the object content.
Note: this type is only provided in borrowed version (i.e. it can own the inner data).
Fields
header: Header<'a>
The object header
data: &'a [u8]
The object contents
Implementations
impl<'a> Any<'a>
impl<'a> Any<'a>
pub const fn new(header: Header<'a>, data: &'a [u8]) -> Any<'a>
pub const fn new(header: Header<'a>, data: &'a [u8]) -> Any<'a>
Create a new Any
from BER/DER header and content
pub const fn from_tag_and_data(tag: Tag, data: &'a [u8]) -> Any<'a>
pub const fn from_tag_and_data(tag: Tag, data: &'a [u8]) -> Any<'a>
Create a new Any
from a tag, and BER/DER content
pub fn with_class(self, class: Class) -> Any<'a>
pub fn with_class(self, class: Class) -> Any<'a>
Update the class of the current object
pub fn as_bytes(&'a self) -> &'a [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
pub fn as_bytes(&'a self) -> &'a [u8]ⓘNotable traits for &'_ mut [u8]impl<'_> Write for &'_ mut [u8]impl<'_> Read for &'_ [u8]
Get the bytes representation of the content
pub fn parse_ber<T>(&'a self) -> Result<(&'a [u8], T), Err<Error>> where
T: FromBer<'a>,
pub fn parse_der<T>(&'a self) -> Result<(&'a [u8], T), Err<Error>> where
T: FromDer<'a>,
impl<'a> Any<'a>
impl<'a> Any<'a>
pub fn bitstring(self) -> Result<BitString<'a>, Error>
pub fn bitstring(self) -> Result<BitString<'a>, Error>
Attempt to convert object to BitString<'a>
(ASN.1 type: BIT STRING
).
pub fn bmpstring(self) -> Result<BmpString<'a>, Error>
pub fn bmpstring(self) -> Result<BmpString<'a>, Error>
Attempt to convert object to BmpString<'a>
(ASN.1 type: BmpString
).
pub fn boolean(self) -> Result<Boolean, Error>
pub fn boolean(self) -> Result<Boolean, Error>
Attempt to convert object to Boolean
(ASN.1 type: BOOLEAN
).
pub fn embedded_pdv(self) -> Result<EmbeddedPdv<'a>, Error>
pub fn embedded_pdv(self) -> Result<EmbeddedPdv<'a>, Error>
Attempt to convert object to EmbeddedPdv<'a>
(ASN.1 type: EMBEDDED PDV
).
pub fn enumerated(self) -> Result<Enumerated, Error>
pub fn enumerated(self) -> Result<Enumerated, Error>
Attempt to convert object to Enumerated
(ASN.1 type: ENUMERATED
).
pub fn generalizedtime(self) -> Result<GeneralizedTime, Error>
pub fn generalizedtime(self) -> Result<GeneralizedTime, Error>
Attempt to convert object to GeneralizedTime
(ASN.1 type: GeneralizedTime
).
pub fn generalstring(self) -> Result<GeneralString<'a>, Error>
pub fn generalstring(self) -> Result<GeneralString<'a>, Error>
Attempt to convert object to GeneralString<'a>
(ASN.1 type: GeneralString
).
pub fn graphicstring(self) -> Result<GraphicString<'a>, Error>
pub fn graphicstring(self) -> Result<GraphicString<'a>, Error>
Attempt to convert object to GraphicString<'a>
(ASN.1 type: GraphicString
).
pub fn ia5string(self) -> Result<Ia5String<'a>, Error>
pub fn ia5string(self) -> Result<Ia5String<'a>, Error>
Attempt to convert object to Ia5String<'a>
(ASN.1 type: IA5String
).
pub fn integer(self) -> Result<Integer<'a>, Error>
pub fn integer(self) -> Result<Integer<'a>, Error>
Attempt to convert object to Integer<'a>
(ASN.1 type: INTEGER
).
pub fn numericstring(self) -> Result<NumericString<'a>, Error>
pub fn numericstring(self) -> Result<NumericString<'a>, Error>
Attempt to convert object to NumericString<'a>
(ASN.1 type: NumericString
).
pub fn objectdescriptor(self) -> Result<ObjectDescriptor<'a>, Error>
pub fn objectdescriptor(self) -> Result<ObjectDescriptor<'a>, Error>
Attempt to convert object to ObjectDescriptor<'a>
(ASN.1 type: ObjectDescriptor
).
pub fn octetstring(self) -> Result<OctetString<'a>, Error>
pub fn octetstring(self) -> Result<OctetString<'a>, Error>
Attempt to convert object to OctetString<'a>
(ASN.1 type: OCTET STRING
).
pub fn oid(self) -> Result<Oid<'a>, Error>
pub fn oid(self) -> Result<Oid<'a>, Error>
Attempt to convert object to Oid<'a>
(ASN.1 type: OBJECT IDENTIFIER
).
pub fn relative_oid(self) -> Result<Oid<'a>, Error>
pub fn relative_oid(self) -> Result<Oid<'a>, Error>
Attempt to convert object to Oid
(ASN.1 type: RELATIVE-OID
).
pub fn printablestring(self) -> Result<PrintableString<'a>, Error>
pub fn printablestring(self) -> Result<PrintableString<'a>, Error>
Attempt to convert object to PrintableString<'a>
(ASN.1 type: PrintableString
).
pub fn sequence(self) -> Result<Sequence<'a>, Error>
pub fn sequence(self) -> Result<Sequence<'a>, Error>
Attempt to convert object to Sequence<'a>
(ASN.1 type: SEQUENCE
).
pub fn string(self) -> Result<String, Error>
pub fn string(self) -> Result<String, Error>
Attempt to convert object to String
(ASN.1 type: UTF8String
).
pub fn teletexstring(self) -> Result<TeletexString<'a>, Error>
pub fn teletexstring(self) -> Result<TeletexString<'a>, Error>
Attempt to convert object to TeletexString<'a>
(ASN.1 type: TeletexString
).
pub fn universalstring(self) -> Result<UniversalString<'a>, Error>
pub fn universalstring(self) -> Result<UniversalString<'a>, Error>
Attempt to convert object to UniversalString<'a>
(ASN.1 type: UniversalString
).
pub fn utctime(self) -> Result<UtcTime, Error>
pub fn utctime(self) -> Result<UtcTime, Error>
Attempt to convert object to UtcTime
(ASN.1 type: UTCTime
).
pub fn utf8string(self) -> Result<Utf8String<'a>, Error>
pub fn utf8string(self) -> Result<Utf8String<'a>, Error>
Attempt to convert object to Utf8String<'a>
(ASN.1 type: UTF8String
).
pub fn videotexstring(self) -> Result<VideotexString<'a>, Error>
pub fn videotexstring(self) -> Result<VideotexString<'a>, Error>
Attempt to convert object to VideotexString<'a>
(ASN.1 type: VideotexString
).
pub fn visiblestring(self) -> Result<VisibleString<'a>, Error>
pub fn visiblestring(self) -> Result<VisibleString<'a>, Error>
Attempt to convert object to VisibleString<'a>
(ASN.1 type: VisibleString
).
Trait Implementations
impl<'_> CheckDerConstraints for Any<'_>
impl<'_> CheckDerConstraints for Any<'_>
fn check_constraints(any: &Any<'_>) -> Result<(), Error>
impl<'_> ToDer for Any<'_>
impl<'_> ToDer for Any<'_>
fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
fn write_der_raw(&self, writer: &mut dyn Write) -> Result<usize, SerializeError>
Similar to using to_der
, but uses header without computing length value
fn to_der_len(&self) -> Result<usize, Error>
fn to_der_len(&self) -> Result<usize, Error>
Get the length of the object, when encoded Read more
fn write_der_header(
&self,
writer: &mut dyn Write
) -> Result<usize, SerializeError>
fn write_der_header(
&self,
writer: &mut dyn Write
) -> Result<usize, SerializeError>
Attempt to write the DER header to this writer.
fn write_der_content(
&self,
writer: &mut dyn Write
) -> Result<usize, SerializeError>
fn write_der_content(
&self,
writer: &mut dyn Write
) -> Result<usize, SerializeError>
Attempt to write the DER content (all except header) to this writer.
fn to_der_vec(&self) -> Result<Vec<u8, Global>, SerializeError>
fn to_der_vec(&self) -> Result<Vec<u8, Global>, SerializeError>
Write the DER encoded representation to a newly allocated Vec<u8>
.
fn to_der_vec_raw(&self) -> Result<Vec<u8, Global>, SerializeError>
fn to_der_vec_raw(&self) -> Result<Vec<u8, Global>, SerializeError>
Similar to using to_vec
, but uses provided values without changes.
This can generate an invalid encoding for a DER object. Read more
impl<'a> TryFrom<Any<'a>> for EndOfContent
impl<'a> TryFrom<Any<'a>> for EndOfContent
impl<'a, T, const CLASS: u8, const TAG: u32> TryFrom<Any<'a>> for TaggedValue<T, Explicit, CLASS, TAG> where
T: FromBer<'a>,
impl<'a, T, const CLASS: u8, const TAG: u32> TryFrom<Any<'a>> for TaggedValue<T, Explicit, CLASS, TAG> where
T: FromBer<'a>,
impl<'a> TryFrom<Any<'a>> for GraphicString<'a>
impl<'a> TryFrom<Any<'a>> for GraphicString<'a>
impl<'a> TryFrom<Any<'a>> for PrintableString<'a>
impl<'a> TryFrom<Any<'a>> for PrintableString<'a>
impl<'a> TryFrom<Any<'a>> for ObjectDescriptor<'a>
impl<'a> TryFrom<Any<'a>> for ObjectDescriptor<'a>
impl<'a> TryFrom<Any<'a>> for Enumerated
impl<'a> TryFrom<Any<'a>> for Enumerated
impl<'a> TryFrom<Any<'a>> for GeneralizedTime
impl<'a> TryFrom<Any<'a>> for GeneralizedTime
impl<'a, T> TryFrom<Any<'a>> for SequenceOf<T> where
T: FromBer<'a>,
impl<'a, T> TryFrom<Any<'a>> for SequenceOf<T> where
T: FromBer<'a>,
impl<'a> TryFrom<Any<'a>> for NumericString<'a>
impl<'a> TryFrom<Any<'a>> for NumericString<'a>
impl<'a> TryFrom<Any<'a>> for EmbeddedPdv<'a>
impl<'a> TryFrom<Any<'a>> for EmbeddedPdv<'a>
impl<'a> TryFrom<Any<'a>> for VisibleString<'a>
impl<'a> TryFrom<Any<'a>> for VisibleString<'a>
impl<'a> TryFrom<Any<'a>> for OctetString<'a>
impl<'a> TryFrom<Any<'a>> for OctetString<'a>
impl<'a> TryFrom<Any<'a>> for GeneralString<'a>
impl<'a> TryFrom<Any<'a>> for GeneralString<'a>
impl<'a> TryFrom<Any<'a>> for Utf8String<'a>
impl<'a> TryFrom<Any<'a>> for Utf8String<'a>
impl<'a> TryFrom<Any<'a>> for TeletexString<'a>
impl<'a> TryFrom<Any<'a>> for TeletexString<'a>
impl<'a> TryFrom<Any<'a>> for VideotexString<'a>
impl<'a> TryFrom<Any<'a>> for VideotexString<'a>
impl<'a> TryFrom<Any<'a>> for UniversalString<'a>
impl<'a> TryFrom<Any<'a>> for UniversalString<'a>
impl<'a, T, const CLASS: u8, const TAG: u32> TryFrom<Any<'a>> for TaggedValue<T, Implicit, CLASS, TAG> where
T: TryFrom<Any<'a>, Error = Error> + Tagged,
impl<'a, T, const CLASS: u8, const TAG: u32> TryFrom<Any<'a>> for TaggedValue<T, Implicit, CLASS, TAG> where
T: TryFrom<Any<'a>, Error = Error> + Tagged,
impl<'a> StructuralPartialEq for Any<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for Any<'a>
impl<'a> Send for Any<'a>
impl<'a> Sync for Any<'a>
impl<'a> Unpin for Any<'a>
impl<'a> UnwindSafe for Any<'a>
Blanket Implementations
impl<'a, T> AsTaggedExplicit<'a> for T where
T: 'a,
impl<'a, T> AsTaggedExplicit<'a> for T where
T: 'a,
fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self>
impl<'a, T> AsTaggedImplicit<'a> for T where
T: 'a,
impl<'a, T> AsTaggedImplicit<'a> for T where
T: 'a,
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoCollection<T> for T
impl<T> IntoCollection<T> for T
sourcefn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
fn into_collection<A>(self) -> SmallVec<A> where
A: Array<Item = T>,
Converts self
into a collection.
fn mapped<U, F, A>(self, f: F) -> SmallVec<A> where
F: FnMut(T) -> U,
A: Array<Item = U>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more