PrivateKey

Struct PrivateKey 

Source
pub struct PrivateKey<const LEN: usize> { /* private fields */ }
Expand description

An RSA Private Key that is LEN bytes long.

Implementations§

Source§

impl PrivateKey<256>

Source

pub fn from_components(n: [u8; 256], d: [u8; 256]) -> Self

Constructor for the private key based on n and d.

Source

pub fn pk(&self) -> &PublicKey<256>

Returns the public key of the private key.

Source

pub fn as_var_len(&self) -> VarLenPrivateKey<'_>

Returns the slice-based private key

Source

pub fn d(&self) -> &[u8; 256]

Returns the private exponent as bytes.

Source§

impl PrivateKey<384>

Source

pub fn from_components(n: [u8; 384], d: [u8; 384]) -> Self

Constructor for the private key based on n and d.

Source

pub fn pk(&self) -> &PublicKey<384>

Returns the public key of the private key.

Source

pub fn as_var_len(&self) -> VarLenPrivateKey<'_>

Returns the slice-based private key

Source

pub fn d(&self) -> &[u8; 384]

Returns the private exponent as bytes.

Source§

impl PrivateKey<512>

Source

pub fn from_components(n: [u8; 512], d: [u8; 512]) -> Self

Constructor for the private key based on n and d.

Source

pub fn pk(&self) -> &PublicKey<512>

Returns the public key of the private key.

Source

pub fn as_var_len(&self) -> VarLenPrivateKey<'_>

Returns the slice-based private key

Source

pub fn d(&self) -> &[u8; 512]

Returns the private exponent as bytes.

Source§

impl PrivateKey<768>

Source

pub fn from_components(n: [u8; 768], d: [u8; 768]) -> Self

Constructor for the private key based on n and d.

Source

pub fn pk(&self) -> &PublicKey<768>

Returns the public key of the private key.

Source

pub fn as_var_len(&self) -> VarLenPrivateKey<'_>

Returns the slice-based private key

Source

pub fn d(&self) -> &[u8; 768]

Returns the private exponent as bytes.

Source§

impl PrivateKey<1024>

Source

pub fn from_components(n: [u8; 1024], d: [u8; 1024]) -> Self

Constructor for the private key based on n and d.

Source

pub fn pk(&self) -> &PublicKey<1024>

Returns the public key of the private key.

Source

pub fn as_var_len(&self) -> VarLenPrivateKey<'_>

Returns the slice-based private key

Source

pub fn d(&self) -> &[u8; 1024]

Returns the private exponent as bytes.

Trait Implementations§

Source§

impl<const LEN: usize> Debug for PrivateKey<LEN>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a PrivateKey<1024>> for VarLenPrivateKey<'a>

Source§

fn from(value: &'a PrivateKey<1024>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PrivateKey<256>> for VarLenPrivateKey<'a>

Source§

fn from(value: &'a PrivateKey<256>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PrivateKey<384>> for VarLenPrivateKey<'a>

Source§

fn from(value: &'a PrivateKey<384>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PrivateKey<512>> for VarLenPrivateKey<'a>

Source§

fn from(value: &'a PrivateKey<512>) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a PrivateKey<768>> for VarLenPrivateKey<'a>

Source§

fn from(value: &'a PrivateKey<768>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<const LEN: usize> Freeze for PrivateKey<LEN>

§

impl<const LEN: usize> RefUnwindSafe for PrivateKey<LEN>

§

impl<const LEN: usize> Send for PrivateKey<LEN>

§

impl<const LEN: usize> Sync for PrivateKey<LEN>

§

impl<const LEN: usize> Unpin for PrivateKey<LEN>

§

impl<const LEN: usize> UnwindSafe for PrivateKey<LEN>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.