pub struct Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,{
bytes: Array<u8, MaxSize<C>>,
r_range: Range<usize>,
s_range: Range<usize>,
}Expand description
ASN.1 DER-encoded signature as specified in RFC5912 Section 6:
ECDSA-Sig-Value ::= SEQUENCE {
r INTEGER,
s INTEGER
}Fields§
§bytes: Array<u8, MaxSize<C>>ASN.1 DER-encoded signature data
r_range: Range<usize>Range of the r value within the signature
s_range: Range<usize>Range of the s value within the signature
Implementations§
Source§impl<C> Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Sourcepub fn from_bytes(input: &[u8]) -> Result<Self>
pub fn from_bytes(input: &[u8]) -> Result<Self>
Parse signature from DER-encoded bytes.
Sourcepub(crate) fn from_components(r: &[u8], s: &[u8]) -> Result<Self>
pub(crate) fn from_components(r: &[u8], s: &[u8]) -> Result<Self>
Create an ASN.1 DER encoded signature from big endian r and s scalar
components.
Trait Implementations§
Source§impl<C> AsRef<[u8]> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> AsRef<[u8]> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<C> Clone for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> Clone for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<C> Debug for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> Debug for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<'a, C> Decode<'a> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<'a, C> Decode<'a> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<D, C> DigestSigner<D, Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
D: Digest + FixedOutput,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<D, C> DigestSigner<D, Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
D: Digest + FixedOutput,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§impl<C, D> DigestVerifier<D, Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic,
D: Digest + Update,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C, D> DigestVerifier<D, Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic,
D: Digest + Update,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§impl<C> Encode for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> Encode for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§fn encoded_len(&self) -> Result<Length>
fn encoded_len(&self) -> Result<Length>
Compute the length of this TLV object in bytes when encoded as ASN.1 DER. Read more
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 TLV object to the provided byte slice, returning a sub-slice
containing the encoded message. Read more
Source§impl<C> FixedTag for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> FixedTag for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<C> From<&SignatureWithOid<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate features der and digest only.
impl<C> From<&SignatureWithOid<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate features
der and digest only.Source§fn from(sig: &SignatureWithOid<C>) -> Signature<C>
fn from(sig: &SignatureWithOid<C>) -> Signature<C>
Converts to this type from the input type.
Source§impl<C> From<Signature<C>> for Box<[u8]>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature alloc only.
impl<C> From<Signature<C>> for Box<[u8]>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
alloc only.Source§impl<C> From<Signature<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> From<Signature<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<C> From<SignatureWithOid<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate features der and digest only.
impl<C> From<SignatureWithOid<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate features
der and digest only.Source§fn from(sig: SignatureWithOid<C>) -> Signature<C>
fn from(sig: SignatureWithOid<C>) -> Signature<C>
Converts to this type from the input type.
Source§impl<C> Hash for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> Hash for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<C> MultipartVerifier<Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> MultipartVerifier<Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§fn multipart_verify(
&self,
msg: &[&[u8]],
signature: &Signature<C>,
) -> Result<()>
fn multipart_verify( &self, msg: &[&[u8]], signature: &Signature<C>, ) -> Result<()>
Equivalent of
Verifier::verify() but the message is provided in non-contiguous byte
slices. Read moreSource§impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> PrehashSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§impl<C> PrehashVerifier<Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> PrehashVerifier<Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
D: Digest + FixedOutput,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C, D> RandomizedDigestSigner<D, Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
D: Digest + FixedOutput,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§impl<C> RandomizedMultipartSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> RandomizedMultipartSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§fn try_multipart_sign_with_rng<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
msg: &[&[u8]],
) -> Result<Signature<C>>
fn try_multipart_sign_with_rng<R: TryCryptoRng + ?Sized>( &self, rng: &mut R, msg: &[&[u8]], ) -> Result<Signature<C>>
Equivalent of
RandomizedSigner::try_sign_with_rng() but the message is provided in
non-contiguous byte slices. Read moreSource§fn multipart_sign_with_rng<R>(&self, rng: &mut R, msg: &[&[u8]]) -> S
fn multipart_sign_with_rng<R>(&self, rng: &mut R, msg: &[&[u8]]) -> S
Equivalent of
RandomizedSigner::sign_with_rng() but the message is provided in
non-contiguous byte slices.Source§impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> RandomizedPrehashSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§fn sign_prehash_with_rng<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
prehash: &[u8],
) -> Result<Signature<C>>
fn sign_prehash_with_rng<R: TryCryptoRng + ?Sized>( &self, rng: &mut R, prehash: &[u8], ) -> Result<Signature<C>>
Attempt to sign the given message digest, returning a digital signature on success, or an
error if something went wrong. Read more
Source§impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> RandomizedSigner<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§fn try_sign_with_rng<R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
msg: &[u8],
) -> Result<Signature<C>>
fn try_sign_with_rng<R: TryCryptoRng + ?Sized>( &self, rng: &mut R, msg: &[u8], ) -> Result<Signature<C>>
Attempt to sign the given message, returning a digital signature on success, or an error if
something went wrong. Read more
Source§impl<C> SignatureBitStringEncoding for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature alloc only.
impl<C> SignatureBitStringEncoding for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
alloc only.Source§impl<C> SignatureEncoding for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature alloc only.
impl<C> SignatureEncoding for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
alloc only.Source§impl<C> Signer<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> Signer<Signature<C>> for SigningKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
Scalar<C>: Invert<Output = CtOption<Scalar<C>>>,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Source§impl<C> TryFrom<&[u8]> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> TryFrom<&[u8]> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<C> TryFrom<Signature<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
impl<C> TryFrom<Signature<C>> for Signature<C>where
C: EcdsaCurve,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Source§impl<C> Verifier<Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature der only.
impl<C> Verifier<Signature<C>> for VerifyingKey<C>where
C: EcdsaCurve + CurveArithmetic + DigestAlgorithm,
SignatureSize<C>: ArraySize,
MaxSize<C>: ArraySize,
<FieldBytesSize<C> as Add>::Output: Add<MaxOverhead> + ArraySize,
Available on crate feature
der only.Auto Trait Implementations§
impl<C> Freeze for Signature<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: Sized,
<<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArraySize>::ArrayType<u8>: Freeze,
impl<C> RefUnwindSafe for Signature<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: Sized,
<<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArraySize>::ArrayType<u8>: RefUnwindSafe,
impl<C> Send for Signature<C>
impl<C> Sync for Signature<C>
impl<C> Unpin for Signature<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: Sized,
<<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArraySize>::ArrayType<u8>: Unpin,
impl<C> UnsafeUnpin for Signature<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: Sized,
<<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArraySize>::ArrayType<u8>: UnsafeUnpin,
impl<C> UnwindSafe for Signature<C>where
<<C as Curve>::FieldBytesSize as Add>::Output: Sized,
<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output: Sized,
<<<<C as Curve>::FieldBytesSize as Add>::Output as Add<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B1>>>::Output as ArraySize>::ArrayType<u8>: UnwindSafe,
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<T> IsConstructed for T
impl<T> IsConstructed for T
Source§const CONSTRUCTED: bool
const CONSTRUCTED: bool
ASN.1 constructed bit