pub struct SignatureWithOid<C: PrimeCurve> { /* private fields */ }
Expand description
An extended Signature
type which is parameterized by an
ObjectIdentifier
which identifies the ECDSA variant used by a
particular signature.
Valid ObjectIdentifiers
are defined in RFC5758 § 3.2:
- SHA-224:
ECDSA_SHA224_OID
(1.2.840.10045.4.3.1) - SHA-256:
ECDSA_SHA256_OID
(1.2.840.10045.4.3.2) - SHA-384:
ECDSA_SHA384_OID
(1.2.840.10045.4.3.3) - SHA-512:
ECDSA_SHA512_OID
(1.2.840.10045.4.3.4)
Implementations§
Source§impl<C> SignatureWithOid<C>where
C: PrimeCurve,
impl<C> SignatureWithOid<C>where
C: PrimeCurve,
Sourcepub fn new(signature: Signature<C>, oid: ObjectIdentifier) -> Result<Self>
pub fn new(signature: Signature<C>, oid: ObjectIdentifier) -> Result<Self>
Create a new signature with an explicitly provided OID.
OID must begin with 1.2.840.10045.4
, the RFC5758 OID prefix for
ECDSA variants.
Sourcepub fn new_with_digest<D>(signature: Signature<C>) -> Result<Self>where
D: AssociatedOid + Digest,
pub fn new_with_digest<D>(signature: Signature<C>) -> Result<Self>where
D: AssociatedOid + Digest,
Create a new signature, determining the OID from the given digest.
Supports SHA-2 family digests as enumerated in RFC5758 § 3.2, i.e. SHA-224, SHA-256, SHA-384, or SHA-512.
Sourcepub fn from_bytes_with_digest<D>(bytes: &SignatureBytes<C>) -> Result<Self>
pub fn from_bytes_with_digest<D>(bytes: &SignatureBytes<C>) -> Result<Self>
Parse a signature from fixed-with bytes.
Sourcepub fn from_slice_with_digest<D>(slice: &[u8]) -> Result<Self>
pub fn from_slice_with_digest<D>(slice: &[u8]) -> Result<Self>
Parse a signature from a byte slice.
Sourcepub fn oid(&self) -> ObjectIdentifier
pub fn oid(&self) -> ObjectIdentifier
Get the ECDSA OID for this signature.
Sourcepub fn to_bytes(&self) -> SignatureBytes<C>
pub fn to_bytes(&self) -> SignatureBytes<C>
Serialize this signature as bytes.
Trait Implementations§
Source§impl<C: Clone + PrimeCurve> Clone for SignatureWithOid<C>
impl<C: Clone + PrimeCurve> Clone for SignatureWithOid<C>
Source§fn clone(&self) -> SignatureWithOid<C>
fn clone(&self) -> SignatureWithOid<C>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<C, D> DigestSigner<D, SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: AssociatedOid + Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C, D> DigestSigner<D, SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
D: AssociatedOid + Digest + FixedOutput<OutputSize = FieldBytesSize<C>>,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§fn try_sign_digest(&self, msg_digest: D) -> Result<SignatureWithOid<C>>
fn try_sign_digest(&self, msg_digest: D) -> Result<SignatureWithOid<C>>
Digest
, returning a
digital signature on success, or an error if something went wrong.Source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Source§impl<C> From<SignatureWithOid<C>> for SignatureBytes<C>
impl<C> From<SignatureWithOid<C>> for SignatureBytes<C>
Source§fn from(signature: SignatureWithOid<C>) -> SignatureBytes<C>
fn from(signature: SignatureWithOid<C>) -> SignatureBytes<C>
Source§impl<C> From<SignatureWithOid<C>> for Signature<C>where
C: PrimeCurve,
impl<C> From<SignatureWithOid<C>> for Signature<C>where
C: PrimeCurve,
Source§fn from(sig: SignatureWithOid<C>) -> Signature<C>
fn from(sig: SignatureWithOid<C>) -> Signature<C>
Source§impl<C: PartialEq + PrimeCurve> PartialEq for SignatureWithOid<C>
impl<C: PartialEq + PrimeCurve> PartialEq for SignatureWithOid<C>
Source§impl<C> SignatureEncoding for SignatureWithOid<C>
NOTE: this implementation assumes the default digest for the given elliptic
curve as defined by hazmat::DigestPrimitive
.
impl<C> SignatureEncoding for SignatureWithOid<C>
NOTE: this implementation assumes the default digest for the given elliptic
curve as defined by hazmat::DigestPrimitive
.
When working with alternative digests, you will need to use e.g.
SignatureWithOid::new_with_digest
.
Source§type Repr = GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>
type Repr = GenericArray<u8, <<C as Curve>::FieldBytesSize as Add>::Output>
Source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
Source§impl<C> Signer<SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
C::Digest: AssociatedOid,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
impl<C> Signer<SignatureWithOid<C>> for SigningKey<C>where
C: PrimeCurve + CurveArithmetic + DigestPrimitive,
C::Digest: AssociatedOid,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>> + SignPrimitive<C>,
SignatureSize<C>: ArrayLength<u8>,
Source§impl<C> TryFrom<&[u8]> for SignatureWithOid<C>
NOTE: this implementation assumes the default digest for the given elliptic
curve as defined by hazmat::DigestPrimitive
.
impl<C> TryFrom<&[u8]> for SignatureWithOid<C>
NOTE: this implementation assumes the default digest for the given elliptic
curve as defined by hazmat::DigestPrimitive
.
When working with alternative digests, you will need to use e.g.
SignatureWithOid::new_with_digest
.
impl<C> Copy for SignatureWithOid<C>where
C: PrimeCurve,
SignatureSize<C>: ArrayLength<u8>,
<SignatureSize<C> as ArrayLength<u8>>::ArrayType: Copy,
impl<C: Eq + PrimeCurve> Eq for SignatureWithOid<C>
impl<C: PrimeCurve> StructuralPartialEq for SignatureWithOid<C>
Auto Trait Implementations§
impl<C> Freeze for SignatureWithOid<C>
impl<C> RefUnwindSafe for SignatureWithOid<C>
impl<C> Send for SignatureWithOid<C>
impl<C> Sync for SignatureWithOid<C>
impl<C> Unpin for SignatureWithOid<C>
impl<C> UnwindSafe for SignatureWithOid<C>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.