pub enum SigningKey {
Hs256(Zeroizing<Vec<u8>>),
Hs384(Zeroizing<Vec<u8>>),
Hs512(Zeroizing<Vec<u8>>),
Rs256Pem(String),
Rs384Pem(String),
Rs512Pem(String),
Rs256Components {
n: String,
e: String,
},
}Expand description
Signing key for JWT signature verification.
Supports both symmetric (HS256) and asymmetric (RS256/RS384/RS512) algorithms.
Variants§
Hs256(Zeroizing<Vec<u8>>)
HMAC-SHA256 symmetric key.
Use for internal services where the same secret is shared between token issuer and validator.
Hs384(Zeroizing<Vec<u8>>)
HMAC-SHA384 symmetric key.
Hs512(Zeroizing<Vec<u8>>)
HMAC-SHA512 symmetric key.
Rs256Pem(String)
RSA public key in PEM format (RS256 algorithm).
Use for external identity providers. The public key is used to verify tokens signed with the provider’s private key.
Rs384Pem(String)
RSA public key in PEM format (RS384 algorithm).
Rs512Pem(String)
RSA public key in PEM format (RS512 algorithm).
Rs256Components
RSA public key components (n, e) for RS256.
Use when receiving keys from JWKS endpoints.
Implementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn hs256_bytes(secret: &[u8]) -> Self
pub fn hs256_bytes(secret: &[u8]) -> Self
Create an HS256 signing key from raw bytes.
Sourcepub fn rs256_components(n: &str, e: &str) -> Self
pub fn rs256_components(n: &str, e: &str) -> Self
Create an RS256 signing key from RSA components.
This is useful when parsing JWKS responses.
Trait Implementations§
Source§impl Clone for SigningKey
impl Clone for SigningKey
Source§fn clone(&self) -> SigningKey
fn clone(&self) -> SigningKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more