pub struct Nonce(pub OctetString);
Expand description
Nonce extension as defined in [RFC 6960 Section 4.4.1].
Tuple Fields§
§0: OctetString
Implementations§
Source§impl Nonce
impl Nonce
Sourcepub fn new(bytes: impl Into<Vec<u8>>) -> Result<Self, Error>
pub fn new(bytes: impl Into<Vec<u8>>) -> Result<Self, Error>
Creates a Nonce object given the bytes
Sourcepub fn generate<R>(rng: &mut R, length: usize) -> Result<Self, Error>where
R: CryptoRngCore,
Available on crate feature rand
only.
pub fn generate<R>(rng: &mut R, length: usize) -> Result<Self, Error>where
R: CryptoRngCore,
rand
only.Creates a Nonce object given a random generator and a length.
A proposed but not (yet) accepted RFC [RFC 8954] wants to limit nonces. RFC 6960 has no mention of a minimum or maximum length.
Nonce ::= OCTET STRING(SIZE(1..32))
Trait Implementations§
Source§impl AsExtension for Nonce
impl AsExtension for Nonce
Source§impl<'a> AsMut<OctetString> for Nonce
impl<'a> AsMut<OctetString> for Nonce
Source§fn as_mut(&mut self) -> &mut OctetString
fn as_mut(&mut self) -> &mut OctetString
Converts this type into a mutable reference of the (usually inferred) input type.
Source§impl<'a> AsRef<OctetString> for Nonce
impl<'a> AsRef<OctetString> for Nonce
Source§fn as_ref(&self) -> &OctetString
fn as_ref(&self) -> &OctetString
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AssociatedOid for Nonce
impl AssociatedOid for Nonce
Source§const OID: ObjectIdentifier = ID_PKIX_OCSP_NONCE
const OID: ObjectIdentifier = ID_PKIX_OCSP_NONCE
The OID associated with this type.
Source§impl<'a> DecodeValue<'a> for Nonce
impl<'a> DecodeValue<'a> for Nonce
Source§impl<'a> EncodeValue for Nonce
impl<'a> EncodeValue for Nonce
Source§impl<'a> From<Nonce> for OctetString
impl<'a> From<Nonce> for OctetString
Source§impl<'a> From<OctetString> for Nonce
impl<'a> From<OctetString> for Nonce
Source§fn from(value: OctetString) -> Self
fn from(value: OctetString) -> Self
Converts to this type from the input type.
impl Eq for Nonce
impl StructuralPartialEq for Nonce
Auto Trait Implementations§
impl Freeze for Nonce
impl RefUnwindSafe for Nonce
impl Send for Nonce
impl Sync for Nonce
impl Unpin for Nonce
impl UnwindSafe for Nonce
Blanket Implementations§
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§impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
impl<'a, T> Decode<'a> for Twhere
T: DecodeValue<'a> + FixedTag,
Source§impl<T> DynAssociatedOid for Twhere
T: AssociatedOid,
impl<T> DynAssociatedOid for Twhere
T: AssociatedOid,
Source§fn oid(&self) -> ObjectIdentifier
fn oid(&self) -> ObjectIdentifier
Get the OID associated with this value.
Source§impl<T> Encode for Twhere
T: EncodeValue + Tagged,
impl<T> Encode for Twhere
T: EncodeValue + Tagged,
Source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
Source§fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided Writer
.
Source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this value to the provided byte slice, returning a sub-slice
containing the encoded message.