Struct josekit::jwk::alg::rsa::RsaKeyPair

source ·
pub struct RsaKeyPair { /* private fields */ }

Implementations§

source§

impl RsaKeyPair

source

pub fn key_len(&self) -> u32

source

pub fn set_algorithm(&mut self, value: Option<&str>)

source

pub fn set_key_id(&mut self, key_id: Option<impl Into<String>>)

source

pub fn into_rsa_pss_key_pair( self, hash: HashAlgorithm, mgf1_hash: HashAlgorithm, salt_len: u8 ) -> RsaPssKeyPair

source

pub fn generate(bits: u32) -> Result<RsaKeyPair, JoseError>

Generate RSA key pair.

§Arguments
  • bits - RSA key length
source

pub fn from_der(input: impl AsRef<[u8]>) -> Result<Self, JoseError>

Create a RSA key pair from a private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey.

§Arguments
  • input - A private key that is a DER encoded PKCS#8 PrivateKeyInfo or PKCS#1 RSAPrivateKey.
source

pub fn from_pem(input: impl AsRef<[u8]>) -> Result<Self, JoseError>

Create a RSA key pair from a private key of common or traditinal PEM format.

Common PEM format is a DER and base64 encoded PKCS#8 PrivateKeyInfo that surrounded by “—–BEGIN/END PRIVATE KEY––”.

Traditional PEM format is a DER and base64 encoded PKCS#1 RSAPrivateKey that surrounded by “—–BEGIN/END RSA PRIVATE KEY––”.

§Arguments
  • input - A private key of common or traditinal PEM format.
source

pub fn from_jwk(jwk: &Jwk) -> Result<Self, JoseError>

Create a RSA key pair from a private key that is formatted by a JWK of RSA type.

§Arguments
  • jwk - A private key that is formatted by a JWK of RSA type.
source

pub fn to_raw_private_key(&self) -> Vec<u8>

source

pub fn to_traditional_pem_private_key(&self) -> Vec<u8>

source

pub fn to_raw_public_key(&self) -> Vec<u8>

source

pub fn to_traditional_pem_public_key(&self) -> Vec<u8>

Trait Implementations§

source§

impl Clone for RsaKeyPair

source§

fn clone(&self) -> RsaKeyPair

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for RsaKeyPair

source§

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

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

impl Deref for RsaKeyPair

§

type Target = dyn KeyPair

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl KeyPair for RsaKeyPair

source§

fn algorithm(&self) -> Option<&str>

Return the applicatable algorithm.
source§

fn key_id(&self) -> Option<&str>

Return the applicatable key ID.
source§

fn to_der_private_key(&self) -> Vec<u8>

source§

fn to_der_public_key(&self) -> Vec<u8>

source§

fn to_pem_private_key(&self) -> Vec<u8>

source§

fn to_pem_public_key(&self) -> Vec<u8>

source§

fn to_jwk_private_key(&self) -> Jwk

source§

fn to_jwk_public_key(&self) -> Jwk

source§

fn to_jwk_key_pair(&self) -> Jwk

source§

fn box_clone(&self) -> Box<dyn KeyPair>

Auto Trait Implementations§

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.