Expand description
A generic DER object
Fields
tag: DerTag
A DER tag that represents this object’s type
value: DerValue
The DER object’s payload
Implementations
sourceimpl DerObject
impl DerObject
sourcepub fn new(tag: DerTag, value: DerValue) -> Self
pub fn new(tag: DerTag, value: DerValue) -> Self
Creates a new DER object from tag
and value
(the length is computed from value
)
sourcepub fn from_raw(tag: u8, bytes: impl Into<Vec<u8>>) -> Self
pub fn from_raw(tag: u8, bytes: impl Into<Vec<u8>>) -> Self
Creates a new DER object from tag
and value
(the length is computed from value
)
Parameters:
tag
: The DER tag value that represents the object’s typevalue
: The DER payload bytes that this object should carry
sourcepub fn deserialize<'a>(
source: impl Iterator<Item = &'a u8>
) -> Result<Self, Asn1DerError>
pub fn deserialize<'a>(
source: impl Iterator<Item = &'a u8>
) -> Result<Self, Asn1DerError>
DER-deserializes the data from source
sourcepub fn serialized_len(&self) -> usize
pub fn serialized_len(&self) -> usize
The length of the DER-serialized representation of self
sourcepub fn serialize<'a>(
&self,
buf: impl Iterator<Item = &'a mut u8>
) -> Result<usize, Asn1DerError>
pub fn serialize<'a>(
&self,
buf: impl Iterator<Item = &'a mut u8>
) -> Result<usize, Asn1DerError>
DER-serializes self
into buf
and returns the amount of bytes written
sourcepub fn compute_serialized_len(payload_len: usize) -> usize
pub fn compute_serialized_len(payload_len: usize) -> usize
Efficiently computes the length of the DER-serialized representation of an object with
payload_len
payload bytes
Trait Implementations
sourceimpl FromDerObject for DerObject
impl FromDerObject for DerObject
sourcefn from_der_object(der_object: DerObject) -> Result<Self, Asn1DerError>
fn from_der_object(der_object: DerObject) -> Result<Self, Asn1DerError>
Converts der_object
into Self
sourcefn deserialize<'a>(
source: impl Iterator<Item = &'a u8>
) -> Result<Self, Asn1DerError>
fn deserialize<'a>(
source: impl Iterator<Item = &'a u8>
) -> Result<Self, Asn1DerError>
DER-deserializes the data from source
sourceimpl IntoDerObject for DerObject
impl IntoDerObject for DerObject
sourcefn into_der_object(self) -> DerObject
fn into_der_object(self) -> DerObject
Converts self
into a DER object
sourcefn serialized_len(&self) -> usize
fn serialized_len(&self) -> usize
Efficiently computes the length of the DER-serialized representation of self
impl Eq for DerObject
impl StructuralEq for DerObject
impl StructuralPartialEq for DerObject
Auto Trait Implementations
impl RefUnwindSafe for DerObject
impl Send for DerObject
impl Sync for DerObject
impl Unpin for DerObject
impl UnwindSafe for DerObject
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
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.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more