Enum jwtk::SomePrivateKey
source · [−]#[non_exhaustive]
pub enum SomePrivateKey {
Ed25519(Ed25519PrivateKey),
Ecdsa(EcdsaPrivateKey),
Rsa(RsaPrivateKey),
}
Expand description
An RSA, EC or Ed25519 private key.
Use this if you just want to load SOME private key from an external pem file.
Variants (Non-exhaustive)
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Ed25519(Ed25519PrivateKey)
Ecdsa(EcdsaPrivateKey)
Rsa(RsaPrivateKey)
Implementations
sourceimpl SomePrivateKey
impl SomePrivateKey
sourcepub fn from_pem(pem: &[u8], if_rsa_algorithm: RsaAlgorithm) -> Result<Self>
pub fn from_pem(pem: &[u8], if_rsa_algorithm: RsaAlgorithm) -> Result<Self>
Read an RSA/EC/Ed25519 private key from PEM.
For an EC/Ed25519 private key, algorithm is deduced from the curve, e.g. P-256 -> ES256.
For an RSA private key, if_rsa_algorithm
is used.
pub fn private_key_to_pem_pkcs8(&self) -> Result<String>
pub fn public_key_to_pem(&self) -> Result<String>
Trait Implementations
sourceimpl Debug for SomePrivateKey
impl Debug for SomePrivateKey
sourceimpl From<EcdsaPrivateKey> for SomePrivateKey
impl From<EcdsaPrivateKey> for SomePrivateKey
sourcefn from(k: EcdsaPrivateKey) -> SomePrivateKey
fn from(k: EcdsaPrivateKey) -> SomePrivateKey
Converts to this type from the input type.
sourceimpl From<Ed25519PrivateKey> for SomePrivateKey
impl From<Ed25519PrivateKey> for SomePrivateKey
sourcefn from(k: Ed25519PrivateKey) -> SomePrivateKey
fn from(k: Ed25519PrivateKey) -> SomePrivateKey
Converts to this type from the input type.
sourceimpl From<RsaPrivateKey> for SomePrivateKey
impl From<RsaPrivateKey> for SomePrivateKey
sourcefn from(k: RsaPrivateKey) -> SomePrivateKey
fn from(k: RsaPrivateKey) -> SomePrivateKey
Converts to this type from the input type.
sourceimpl PrivateKeyToJwk for SomePrivateKey
impl PrivateKeyToJwk for SomePrivateKey
fn private_key_to_jwk(&self) -> Result<Jwk>
sourceimpl PublicKeyToJwk for SomePrivateKey
impl PublicKeyToJwk for SomePrivateKey
fn public_key_to_jwk(&self) -> Result<Jwk>
sourceimpl SigningKey for SomePrivateKey
impl SigningKey for SomePrivateKey
Auto Trait Implementations
impl RefUnwindSafe for SomePrivateKey
impl Send for SomePrivateKey
impl Sync for SomePrivateKey
impl Unpin for SomePrivateKey
impl UnwindSafe for SomePrivateKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more