pub struct BarePrivateKey { /* private fields */ }Expand description
A bare private key contains one of the following:
- An RSA private key
- An ECDSA private key (P-256)
- A symmetric key
Implementations§
Source§impl BarePrivateKey
impl BarePrivateKey
Sourcepub fn from_jwt_ec(
crv: &str,
d: &str,
x: &str,
y: &str,
) -> Result<Self, KeyError>
pub fn from_jwt_ec( crv: &str, d: &str, x: &str, y: &str, ) -> Result<Self, KeyError>
Load an ECDSA key from a JWK.
Sourcepub fn from_jwt_rsa(
n: &str,
e: &str,
d: &str,
p: &str,
q: &str,
dp: &str,
dq: &str,
qinv: &str,
) -> Result<Self, KeyError>
pub fn from_jwt_rsa( n: &str, e: &str, d: &str, p: &str, q: &str, dp: &str, dq: &str, qinv: &str, ) -> Result<Self, KeyError>
Load an RSA key from a JWK.
Sourcepub fn from_jwt_oct(k: &str) -> Result<Self, KeyError>
pub fn from_jwt_oct(k: &str) -> Result<Self, KeyError>
Load an HMAC key from a base64-encoded string.
Sourcepub fn from_raw_oct(key: &[u8]) -> Result<Self, KeyError>
pub fn from_raw_oct(key: &[u8]) -> Result<Self, KeyError>
Load an HMAC key from a raw byte slice.
Sourcepub fn from_pem(pem: &str) -> Result<Self, KeyError>
pub fn from_pem(pem: &str) -> Result<Self, KeyError>
Load a key from a PEM-encoded string. Supported formats are PKCS1, PKCS8,
SEC1, and JWT OCTAL KEY.
pub fn from_pem_multiple( pem: &str, ) -> Result<Vec<Result<Self, KeyError>>, KeyError>
pub fn to_public(&self) -> Result<BarePublicKey, KeyError>
pub fn into_public(self) -> Result<BarePublicKey, KeyError>
pub fn clone_key(&self) -> Self
pub fn to_pem(&self) -> String
pub fn to_pem_public(&self) -> Result<String, KeyError>
pub fn key_type(&self) -> KeyType
Trait Implementations§
Source§impl Debug for BarePrivateKey
impl Debug for BarePrivateKey
Source§impl Hash for BarePrivateKey
impl Hash for BarePrivateKey
Source§impl PartialEq for BarePrivateKey
impl PartialEq for BarePrivateKey
Source§impl TryInto<EncodingKey> for &BarePrivateKey
impl TryInto<EncodingKey> for &BarePrivateKey
impl Eq for BarePrivateKey
impl StructuralPartialEq for BarePrivateKey
Auto Trait Implementations§
impl Freeze for BarePrivateKey
impl RefUnwindSafe for BarePrivateKey
impl Send for BarePrivateKey
impl Sync for BarePrivateKey
impl Unpin for BarePrivateKey
impl UnwindSafe for BarePrivateKey
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