pub struct GenericSigningKey<D, T, M>{ /* private fields */ }Expand description
Signing key for RSASSA-PKCS1-v1_5 signatures — heapless variant.
Generic over the digest D, integer type T, and Montgomery parameters
M. Holds a GenericRsaPrivateKey<T, M> plus the precomputed
DigestInfo prefix for D.
Implementations§
Source§impl<D, T, M> GenericSigningKey<D, T, M>
impl<D, T, M> GenericSigningKey<D, T, M>
Sourcepub fn new(key: GenericRsaPrivateKey<T, M>) -> Self
pub fn new(key: GenericRsaPrivateKey<T, M>) -> Self
Create a new signing key with a precomputed prefix for digest D.
Source§impl<D, T, M> GenericSigningKey<D, T, M>
impl<D, T, M> GenericSigningKey<D, T, M>
Sourcepub fn new_unprefixed(key: GenericRsaPrivateKey<T, M>) -> Self
pub fn new_unprefixed(key: GenericRsaPrivateKey<T, M>) -> Self
Create a new signing key with an empty prefix (raw signatures, no
DigestInfo wrapper). Unusual — most callers want [new] instead.
Source§impl<D, T, M> GenericSigningKey<D, T, M>where
D: Digest,
T: UnsignedModularInt + Zeroize,
T::Bytes: Zeroize,
M: ModulusParams<Modulus = T> + CtModulusParams,
M::MontgomeryForm: Pow<M> + PowBoundedExp<M>,
impl<D, T, M> GenericSigningKey<D, T, M>where
D: Digest,
T: UnsignedModularInt + Zeroize,
T::Bytes: Zeroize,
M: ModulusParams<Modulus = T> + CtModulusParams,
M::MontgomeryForm: Pow<M> + PowBoundedExp<M>,
Sourcepub fn try_sign_into<'sig>(
&self,
msg: &[u8],
em_storage: &mut [u8],
sig_storage: &'sig mut [u8],
) -> Result<&'sig [u8]>
pub fn try_sign_into<'sig>( &self, msg: &[u8], em_storage: &mut [u8], sig_storage: &'sig mut [u8], ) -> Result<&'sig [u8]>
Sign msg (hashed internally with D) into sig_storage.
Uses em_storage as scratch for the EM encoding.
Both buffers must be at least self.inner.size() bytes.
Mirrors the shape of
crate::traits::RandomizedEncryptor::encrypt_with_rng_into on
the encrypt side: caller owns storage, returned slice borrows from
sig_storage with the same lifetime.
Sourcepub fn try_sign_prehash_into<'sig>(
&self,
prehash: &[u8],
em_storage: &mut [u8],
sig_storage: &'sig mut [u8],
) -> Result<&'sig [u8]>
pub fn try_sign_prehash_into<'sig>( &self, prehash: &[u8], em_storage: &mut [u8], sig_storage: &'sig mut [u8], ) -> Result<&'sig [u8]>
Sign a precomputed prehash (D::output_size() bytes) into
sig_storage. The caller is responsible for the hash; this skips
the internal D::digest(msg) step.
Returns [Error::InputNotHashed] if prehash.len() doesn’t match
D::output_size() — a mismatch would silently produce malformed
PKCS#1 v1.5 padding rather than a usable signature.
Source§impl<D, T, M> GenericSigningKey<D, T, M>where
D: Digest,
T: UnsignedModularInt + Zeroize + TryRandomMod,
T::Bytes: Zeroize,
M: ModulusParams<Modulus = T> + CtModulusParams,
M::MontgomeryForm: Pow<M> + PowBoundedExp<M> + InvertCt<M> + MulCt<M>,
impl<D, T, M> GenericSigningKey<D, T, M>where
D: Digest,
T: UnsignedModularInt + Zeroize + TryRandomMod,
T::Bytes: Zeroize,
M: ModulusParams<Modulus = T> + CtModulusParams,
M::MontgomeryForm: Pow<M> + PowBoundedExp<M> + InvertCt<M> + MulCt<M>,
Sourcepub fn try_sign_with_rng_into<'sig, R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
msg: &[u8],
em_storage: &mut [u8],
sig_storage: &'sig mut [u8],
) -> Result<&'sig [u8]>
pub fn try_sign_with_rng_into<'sig, R: TryCryptoRng + ?Sized>( &self, rng: &mut R, msg: &[u8], em_storage: &mut [u8], sig_storage: &'sig mut [u8], ) -> Result<&'sig [u8]>
RNG-driven blinded variant of Self::try_sign_into. Uses
rng to sample a fresh blinding factor per signature.
Sourcepub fn try_sign_prehash_with_rng_into<'sig, R: TryCryptoRng + ?Sized>(
&self,
rng: &mut R,
prehash: &[u8],
em_storage: &mut [u8],
sig_storage: &'sig mut [u8],
) -> Result<&'sig [u8]>
pub fn try_sign_prehash_with_rng_into<'sig, R: TryCryptoRng + ?Sized>( &self, rng: &mut R, prehash: &[u8], em_storage: &mut [u8], sig_storage: &'sig mut [u8], ) -> Result<&'sig [u8]>
RNG-driven blinded variant of Self::try_sign_prehash_into.
Source§impl<D, T, M> GenericSigningKey<D, T, M>
impl<D, T, M> GenericSigningKey<D, T, M>
Sourcepub fn to_verifying_key(&self) -> GenericVerifyingKey<D, T, M>where
GenericRsaPublicKey<T, M>: Clone,
pub fn to_verifying_key(&self) -> GenericVerifyingKey<D, T, M>where
GenericRsaPublicKey<T, M>: Clone,
Derive the matching GenericVerifyingKey from this signing
key, preserving the existing DigestInfo prefix (so unprefixed
signing keys yield unprefixed verifying keys). Not named
verifying_key because that would shadow
signature::Keypair::verifying_key for callers using
method-call syntax.
Source§impl<D> GenericSigningKey<D, BoxedUint, BoxedMontyParams>where
D: Digest + AssociatedOid,
impl<D> GenericSigningKey<D, BoxedUint, BoxedMontyParams>where
D: Digest + AssociatedOid,
Source§impl<D> GenericSigningKey<D, BoxedUint, BoxedMontyParams>where
D: Digest,
impl<D> GenericSigningKey<D, BoxedUint, BoxedMontyParams>where
D: Digest,
Trait Implementations§
Source§impl<D, T, M> AsRef<GenericRsaPrivateKey<T, M>> for GenericSigningKey<D, T, M>
impl<D, T, M> AsRef<GenericRsaPrivateKey<T, M>> for GenericSigningKey<D, T, M>
Source§fn as_ref(&self) -> &GenericRsaPrivateKey<T, M>
fn as_ref(&self) -> &GenericRsaPrivateKey<T, M>
Source§impl<D, T, M> Clone for GenericSigningKey<D, T, M>
Available on crate feature alloc only.
impl<D, T, M> Clone for GenericSigningKey<D, T, M>
alloc only.Source§impl<D, T, M> Debug for GenericSigningKey<D, T, M>where
D: Digest,
T: UnsignedModularInt + Zeroize,
M: ModulusParams<Modulus = T>,
GenericRsaPrivateKey<T, M>: Debug,
impl<D, T, M> Debug for GenericSigningKey<D, T, M>where
D: Digest,
T: UnsignedModularInt + Zeroize,
M: ModulusParams<Modulus = T>,
GenericRsaPrivateKey<T, M>: Debug,
Source§impl<D> From<GenericSigningKey<D, BoxedUint, BoxedMontyParams>> for RsaPrivateKeywhere
D: Digest,
Available on crate feature alloc only.
impl<D> From<GenericSigningKey<D, BoxedUint, BoxedMontyParams>> for RsaPrivateKeywhere
D: Digest,
alloc only.Source§fn from(key: SigningKey<D>) -> Self
fn from(key: SigningKey<D>) -> Self
Source§impl<D, T, M> Zeroize for GenericSigningKey<D, T, M>
impl<D, T, M> Zeroize for GenericSigningKey<D, T, M>
Auto Trait Implementations§
impl<D, T, M> Freeze for GenericSigningKey<D, T, M>
impl<D, T, M> RefUnwindSafe for GenericSigningKey<D, T, M>where
T: RefUnwindSafe,
D: RefUnwindSafe,
M: RefUnwindSafe,
<M as ModulusParams>::MontgomeryForm: RefUnwindSafe,
impl<D, T, M> Send for GenericSigningKey<D, T, M>
impl<D, T, M> Sync for GenericSigningKey<D, T, M>
impl<D, T, M> Unpin for GenericSigningKey<D, T, M>
impl<D, T, M> UnsafeUnpin for GenericSigningKey<D, T, M>
impl<D, T, M> UnwindSafe for GenericSigningKey<D, T, M>where
T: UnwindSafe,
D: UnwindSafe,
M: UnwindSafe,
<M as ModulusParams>::MontgomeryForm: UnwindSafe,
Blanket Implementations§
Source§impl<S, T> AsyncRandomizedSigner<S> for Twhere
T: RandomizedSigner<S>,
impl<S, T> AsyncRandomizedSigner<S> for Twhere
T: RandomizedSigner<S>,
Source§async fn try_sign_with_rng_async<R>(
&self,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
async fn try_sign_with_rng_async<R>(
&self,
rng: &mut R,
msg: &[u8],
) -> Result<S, Error>where
R: TryCryptoRng + ?Sized,
Source§impl<S, T> AsyncSigner<S> for Twhere
T: Signer<S>,
impl<S, T> AsyncSigner<S> for Twhere
T: Signer<S>,
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> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<AnyRef<'a>, &'a OctetStringRef, BitStringRef<'a>>, Error = Error>,
impl<T> DecodePrivateKey for Twhere
T: for<'a> TryFrom<PrivateKeyInfo<AnyRef<'a>, &'a OctetStringRef, BitStringRef<'a>>, Error = Error>,
Source§fn from_pkcs8_der(bytes: &[u8]) -> Result<T, Error>
fn from_pkcs8_der(bytes: &[u8]) -> Result<T, Error>
Source§fn from_pkcs8_pem(s: &str) -> Result<Self, Error>
fn from_pkcs8_pem(s: &str) -> Result<Self, Error>
pem only.impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> DynAssociatedAlgorithmIdentifier for Twhere
T: AssociatedAlgorithmIdentifier,
impl<T> DynAssociatedAlgorithmIdentifier for Twhere
T: AssociatedAlgorithmIdentifier,
Source§fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
fn algorithm_identifier(&self) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier for this structure. Read moreSource§impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
impl<T> DynSignatureAlgorithmIdentifier for Twhere
T: SignatureAlgorithmIdentifier,
Source§fn signature_algorithm_identifier(
&self,
) -> Result<AlgorithmIdentifier<Any>, Error>
fn signature_algorithm_identifier( &self, ) -> Result<AlgorithmIdentifier<Any>, Error>
AlgorithmIdentifier for the corresponding signature system. Read more