pub struct GenericSigningKey<D, T, M>{ /* private fields */ }Expand description
Signing key for RSASSA-PSS — heapless variant.
Generic over the digest D, integer type T, and Montgomery parameters
M. Holds a GenericRsaPrivateKey<T, M> plus the salt length to use
when signing (caller-chosen at construction; defaults to
<D as Digest>::output_size() via new).
PSS has no DigestInfo prefix — D is purely a phantom marker for the
digest algorithm used by both encode and verify.
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
Construct with salt length = D::output_size() (standard choice
per RFC 8017 § 8.1).
Sourcepub fn new_with_salt_len(
key: GenericRsaPrivateKey<T, M>,
salt_len: usize,
) -> Self
pub fn new_with_salt_len( key: GenericRsaPrivateKey<T, M>, salt_len: usize, ) -> Self
Construct with a custom salt length.
Source§impl<D, T, M> GenericSigningKey<D, T, M>where
D: Digest + FixedOutputReset,
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 + FixedOutputReset,
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],
salt_storage: &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], salt_storage: &mut [u8], ) -> Result<&'sig [u8]>
Sign msg (hashed internally with D) into sig_storage, drawing
the PSS salt AND the RSA base-blinding factor from rng. Uses
em_storage and salt_storage as scratch. All three buffers
must be at least the relevant sizes (em_storage:
em_bits.div_ceil(8); sig_storage: n.size();
salt_storage: self.salt_len()).
Mirrors crate::traits::RandomizedEncryptor::encrypt_with_rng_into:
caller owns storage, returned slice borrows from sig_storage.
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],
salt_storage: &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], salt_storage: &mut [u8], ) -> Result<&'sig [u8]>
Sign a precomputed prehash (D::output_size() bytes) into
sig_storage, drawing the PSS salt AND the RSA base-blinding
factor from rng.
Returns Error::InputNotHashed if prehash.len() doesn’t match
D::output_size(). Returns Error::OutputBufferTooSmall if
salt_storage.len() < self.salt_len().
Source§impl<D, T, M> GenericSigningKey<D, T, M>where
D: Digest + FixedOutputReset,
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 + FixedOutputReset,
T: UnsignedModularInt + Zeroize,
T::Bytes: Zeroize,
M: ModulusParams<Modulus = T> + CtModulusParams,
M::MontgomeryForm: Pow<M> + PowBoundedExp<M>,
Sourcepub fn try_sign_prehash_with_salt_into<'sig>(
&self,
prehash: &[u8],
salt: &[u8],
em_storage: &mut [u8],
sig_storage: &'sig mut [u8],
) -> Result<&'sig [u8]>
pub fn try_sign_prehash_with_salt_into<'sig>( &self, prehash: &[u8], salt: &[u8], em_storage: &mut [u8], sig_storage: &'sig mut [u8], ) -> Result<&'sig [u8]>
Sign with caller-supplied salt — useful for determinism in tests.
Returns Error::InputNotHashed if prehash.len() doesn’t match
D::output_size(). Returns Error::InvalidArguments if
salt.len() != self.salt_len() — a mismatch silently produces a
signature that no verifier configured with the key’s advertised
salt_len will accept, so we reject it up front.
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<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 more