pub struct RsaKeyPair { /* private fields */ }
Implementations§
source§impl RsaKeyPair
impl RsaKeyPair
pub fn key_len(&self) -> u32
pub fn set_algorithm(&mut self, value: Option<&str>)
pub fn set_key_id(&mut self, key_id: Option<impl Into<String>>)
pub fn into_rsa_pss_key_pair( self, hash: HashAlgorithm, mgf1_hash: HashAlgorithm, salt_len: u8 ) -> RsaPssKeyPair
sourcepub fn from_der(input: impl AsRef<[u8]>) -> Result<Self, JoseError>
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.
sourcepub fn from_pem(input: impl AsRef<[u8]>) -> Result<Self, JoseError>
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.
sourcepub fn from_jwk(jwk: &Jwk) -> Result<Self, JoseError>
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.
pub fn to_raw_private_key(&self) -> Vec<u8>
pub fn to_traditional_pem_private_key(&self) -> Vec<u8>
pub fn to_raw_public_key(&self) -> Vec<u8>
pub fn to_traditional_pem_public_key(&self) -> Vec<u8>
Trait Implementations§
source§impl Clone for RsaKeyPair
impl Clone for RsaKeyPair
source§fn clone(&self) -> RsaKeyPair
fn clone(&self) -> RsaKeyPair
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for RsaKeyPair
impl Debug for RsaKeyPair
source§impl Deref for RsaKeyPair
impl Deref for RsaKeyPair
source§impl KeyPair for RsaKeyPair
impl KeyPair for RsaKeyPair
fn to_der_private_key(&self) -> Vec<u8>
fn to_der_public_key(&self) -> Vec<u8>
fn to_pem_private_key(&self) -> Vec<u8>
fn to_pem_public_key(&self) -> Vec<u8>
fn to_jwk_private_key(&self) -> Jwk
fn to_jwk_public_key(&self) -> Jwk
fn to_jwk_key_pair(&self) -> Jwk
fn box_clone(&self) -> Box<dyn KeyPair>
Auto Trait Implementations§
impl Freeze for RsaKeyPair
impl RefUnwindSafe for RsaKeyPair
impl Send for RsaKeyPair
impl Sync for RsaKeyPair
impl Unpin for RsaKeyPair
impl UnwindSafe for RsaKeyPair
Blanket Implementations§
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
Mutably borrows from an owned value. Read more