Skip to main content

PublicKeyParts

Trait PublicKeyParts 

Source
pub trait PublicKeyParts {
    // Required methods
    fn n(&self) -> &NonZero<BoxedUint>;
    fn e(&self) -> &BoxedUint;
    fn n_params(&self) -> &BoxedMontyParams;

    // Provided methods
    fn size(&self) -> usize { ... }
    fn n_bits_precision(&self) -> u32 { ... }
    fn n_bytes(&self) -> Box<[u8]> { ... }
    fn e_bytes(&self) -> Box<[u8]> { ... }
}
Expand description

Components of an RSA public key.

Required Methods§

Source

fn n(&self) -> &NonZero<BoxedUint>

Returns the modulus of the key.

Source

fn e(&self) -> &BoxedUint

Returns the public exponent of the key.

Source

fn n_params(&self) -> &BoxedMontyParams

Returns the parameters for montgomery operations.

Provided Methods§

Source

fn size(&self) -> usize

Returns k, the modulus length in octets from RFC8017: ceil(modBits / 8).

Ciphertexts and signatures have this length, including any leading zero octets. This may be smaller than the modulus’s allocated storage width.

Source

fn n_bits_precision(&self) -> u32

Returns the limb-aligned storage precision of n in bits.

This can exceed the modulus bit length (modBits in RFC8017). Use this precision for integer arithmetic and decoding representatives, and Self::size for wire encodings.

Source

fn n_bytes(&self) -> Box<[u8]>

Returns the big endian serialization of the modulus of the key

Source

fn e_bytes(&self) -> Box<[u8]>

Returns the big endian serialization of the public exponent of the key

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§