Struct rsa_cortex_m4::PrivateKey[][src]

pub struct PrivateKey<const D: usize> { /* fields omitted */ }

RSA private key.

Fundamentally, this consists of two different primes p and q, which should both have bit length 8L (i.e., L4 bytes). Additionally, d_p = e^{-1} (mod p) and d_q = e^{-1} (mod q) are stored.

It's quite sad, but we can't enforce the bound L2 = 2*L.

Implementations

impl<const D: usize> PrivateKey<D>[src]

pub fn decryption_primitive(&self, ciphertext: &[u8]) -> Result<Long<D>>[src]

pub fn classic_decryption_primitive(&self, ciphertext: &[u8]) -> Result<Long<D>>[src]

pub fn inversion_free_decryption(&self, ciphertext: &[u8]) -> Result<Long<D>>[src]

This saves calculating and storing the inverse $q^{-1}\text{ mod }p$.

Source

pub fn blinded_inversion_free_decryption(
    &self,
    rng: impl CryptoRng + RngCore,
    ciphertext: &[u8]
) -> Result<Long<D>>
[src]

As also explained in Improvements..., it is easy to blind the factors.

pub fn signature_primitive(&self, msg: &[u8]) -> Result<Long<D>>[src]

pub fn sign<P, R>(&self, msg: &[u8], _padding: P, rng: R) -> Result<Long<D>> where
    P: SignaturePadding<D>,
    R: CryptoRng + RngCore
[src]

Sign a message with respect to a padding method.

pub fn decrypt<P>(&self, ciphertext: &[u8], _: P) -> Result<Unpadded<D>> where
    P: EncryptionPadding<D>, 
[src]

Decrypt a ciphertext with respect to a padding method.

impl<const L: usize> PrivateKey<L>[src]

pub fn new(_rng: impl RngCore + CryptoRng) -> Result<Self>[src]

Trait Implementations

impl<const D: usize> Bits for PrivateKey<D>[src]

impl<const D: usize> From<(Prime<D, 0_usize>, Prime<D, 0_usize>)> for PrivateKey<D>[src]

impl<const D: usize> Zeroize for PrivateKey<D>[src]

Auto Trait Implementations

impl<const D: usize> Send for PrivateKey<D>[src]

impl<const D: usize> Sync for PrivateKey<D>[src]

impl<const D: usize> Unpin for PrivateKey<D>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.