pub struct Key { /* private fields */ }Expand description
A JSON Web Key (RFC 7517).
Represents a single cryptographic key with its parameters and metadata.
§Examples
use jwk_simple::{Key, KeyType};
// Parse from JSON
let json = r#"{"kty":"RSA","n":"AQAB","e":"AQAB"}"#;
let jwk: Key = serde_json::from_str(json).unwrap();
// Check key properties
assert_eq!(jwk.kty(), KeyType::Rsa);
assert!(jwk.is_public_key_only());Implementations§
Source§impl Key
impl Key
Sourcepub fn is_web_crypto_compatible(&self) -> bool
Available on crate feature web-crypto and WebAssembly only.
pub fn is_web_crypto_compatible(&self) -> bool
web-crypto and WebAssembly only.Sourcepub async fn import_as_verify_key(&self) -> Result<CryptoKey>
Available on crate feature web-crypto and WebAssembly only.
pub async fn import_as_verify_key(&self) -> Result<CryptoKey>
web-crypto and WebAssembly only.Imports this key as a CryptoKey for signature verification.
RSA and HMAC keys must have their alg field set. For keys without alg
(common in JWKS from OIDC providers), use
import_as_verify_key_for_alg instead.
§Errors
Error::UnsupportedForWebCryptoif the key type is not supportedError::WebCryptoif the import operation fails or the key is missing a requiredalgfield (RSA/HMAC only)
Sourcepub async fn import_as_sign_key(&self) -> Result<CryptoKey>
Available on crate feature web-crypto and WebAssembly only.
pub async fn import_as_sign_key(&self) -> Result<CryptoKey>
web-crypto and WebAssembly only.Imports this key as a CryptoKey for signing.
RSA and HMAC keys must have their alg field set. For keys without alg,
use import_as_sign_key_for_alg instead.
§Errors
Error::UnsupportedForWebCryptoif the key type is not supportedError::WebCryptoif the import operation fails or the key is missing a requiredalgfield (RSA/HMAC only)
Sourcepub async fn import_as_encrypt_key(&self) -> Result<CryptoKey>
Available on crate feature web-crypto and WebAssembly only.
pub async fn import_as_encrypt_key(&self) -> Result<CryptoKey>
web-crypto and WebAssembly only.Imports this key as a CryptoKey for encryption.
§Errors
Error::UnsupportedForWebCryptoif the key type is not supportedError::WebCryptoif the import operation fails
Sourcepub async fn import_as_decrypt_key(&self) -> Result<CryptoKey>
Available on crate feature web-crypto and WebAssembly only.
pub async fn import_as_decrypt_key(&self) -> Result<CryptoKey>
web-crypto and WebAssembly only.Imports this key as a CryptoKey for decryption.
§Errors
Error::UnsupportedForWebCryptoif the key type is not supportedError::WebCryptoif the import operation fails
Sourcepub async fn import_as_verify_key_for_alg(
&self,
alg: &Algorithm,
) -> Result<CryptoKey>
Available on crate feature web-crypto and WebAssembly only.
pub async fn import_as_verify_key_for_alg( &self, alg: &Algorithm, ) -> Result<CryptoKey>
web-crypto and WebAssembly only.Imports this key as a CryptoKey for signature verification with an explicit algorithm.
This is useful when the key’s alg field is absent (common in JWKS from
OIDC providers). WebCrypto locks the hash algorithm at import time, so the
algorithm must be known before importing. The alg parameter overrides the
key’s own alg field.
§Errors
Error::UnsupportedForWebCryptoif the key type is not supportedError::WebCryptoif the import operation fails
Sourcepub async fn import_as_sign_key_for_alg(
&self,
alg: &Algorithm,
) -> Result<CryptoKey>
Available on crate feature web-crypto and WebAssembly only.
pub async fn import_as_sign_key_for_alg( &self, alg: &Algorithm, ) -> Result<CryptoKey>
web-crypto and WebAssembly only.Imports this key as a CryptoKey for signing with an explicit algorithm.
This is useful when the key’s alg field is absent. See
Key::import_as_verify_key_for_alg for more details.
§Errors
Error::UnsupportedForWebCryptoif the key type is not supportedError::WebCryptoif the import operation fails
Source§impl Key
impl Key
Sourcepub fn new(params: KeyParams) -> Self
pub fn new(params: KeyParams) -> Self
Creates a new Key from key-type-specific parameters.
The key type is automatically derived from the KeyParams variant via
the kty() accessor, which makes it impossible to construct
a Key with a mismatched key type.
Use the with_* methods to set optional metadata fields:
§Examples
use jwk_simple::{Key, KeyType, KeyParams, RsaParams, KeyUse, Algorithm};
use jwk_simple::encoding::Base64UrlBytes;
let key = Key::new(KeyParams::Rsa(RsaParams::new_public(
Base64UrlBytes::new(vec![1, 2, 3]),
Base64UrlBytes::new(vec![1, 0, 1]),
)))
.with_kid("my-key-id")
.with_alg(Algorithm::Rs256)
.with_use(KeyUse::Signature);
assert_eq!(key.kty(), KeyType::Rsa);
assert_eq!(key.kid(), Some("my-key-id"));Sourcepub fn kty(&self) -> KeyType
pub fn kty(&self) -> KeyType
Returns the key type, derived from the KeyParams variant.
This is always consistent with the key’s parameters:
Sourcepub fn key_ops(&self) -> Option<&[KeyOperation]>
pub fn key_ops(&self) -> Option<&[KeyOperation]>
Returns the permitted operations (key_ops), if present.
Sourcepub fn x5t(&self) -> Option<&str>
pub fn x5t(&self) -> Option<&str>
Returns the X.509 SHA-1 certificate thumbprint (x5t), if present.
Sourcepub fn x5t_s256(&self) -> Option<&str>
pub fn x5t_s256(&self) -> Option<&str>
Returns the X.509 SHA-256 certificate thumbprint (x5t#S256), if present.
Sourcepub fn with_key_ops(
self,
key_ops: impl IntoIterator<Item = KeyOperation>,
) -> Self
pub fn with_key_ops( self, key_ops: impl IntoIterator<Item = KeyOperation>, ) -> Self
Sets the permitted key operations (key_ops).
Sourcepub fn with_alg(self, alg: Algorithm) -> Self
pub fn with_alg(self, alg: Algorithm) -> Self
Sets the algorithm intended for use with the key (alg).
Sourcepub fn with_x5t(self, x5t: impl Into<String>) -> Self
pub fn with_x5t(self, x5t: impl Into<String>) -> Self
Sets the X.509 certificate SHA-1 thumbprint (x5t).
Sourcepub fn with_x5t_s256(self, x5t_s256: impl Into<String>) -> Self
pub fn with_x5t_s256(self, x5t_s256: impl Into<String>) -> Self
Sets the X.509 certificate SHA-256 thumbprint (x5t#S256).
Sourcepub fn is_public_key_only(&self) -> bool
pub fn is_public_key_only(&self) -> bool
Returns true if this contains only public key parameters.
Sourcepub fn has_private_key(&self) -> bool
pub fn has_private_key(&self) -> bool
Returns true if this contains private key parameters.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validates the JWK structure and metadata consistency.
This is a context-free structural check: it verifies the key material is well-formed, metadata fields are internally consistent, and X.509 fields are properly encoded and match the key material.
This method does not check algorithm suitability, key strength for
a specific algorithm, or operation intent, even if the alg field is
set on the key. A key with "alg": "RS256" on a symmetric key type
passes validate() because the key material itself is structurally
valid; the algorithm mismatch is a suitability concern.
Use Key::validate_for_use for those checks.
In other words, validate() is the context-free gate: it validates the
key’s own parameters and metadata (use, key_ops, x5u, x5c,
x5t, x5t#S256) without deciding whether the key is acceptable for a
particular algorithm or operation.
This method does not perform PKIX trust/path validation for x5c
chains (trust anchors, validity period, key usage/EKU, revocation, etc.).
PKIX trust validation is application-defined and out of scope for this crate.
Sourcepub fn validate_for_use(
&self,
alg: &Algorithm,
ops: impl IntoIterator<Item = KeyOperation>,
) -> Result<()>
pub fn validate_for_use( &self, alg: &Algorithm, ops: impl IntoIterator<Item = KeyOperation>, ) -> Result<()>
Validates this key for a specific algorithm and operation(s).
This is the full pre-use gate: it performs structural validation
(Key::validate) followed by algorithm suitability checks
(type compatibility, key strength), algorithm-operation compatibility
checks (requested operation is valid for the algorithm), operation
capability checks (key material can actually perform the operation),
and operation-intent enforcement (metadata permits the requested
operations).
The alg parameter controls which algorithm constraints are applied
(key type, minimum strength). If the key declares its own alg, it must
match the requested algorithm. Unknown algorithms are rejected because
suitability (type compatibility and strength) cannot be validated for
them.
At least one operation must be provided. Passing an empty iterator returns an error (this is a caller precondition, not a key problem).
This method calls Key::validate internally, so callers do not
need to call it separately.
This is the full pre-use gate for direct key use. It layers algorithm
suitability, operation/algorithm compatibility, key-material capability,
and operation intent on top of Key::validate.
§Examples
use jwk_simple::{Key, Algorithm, KeyOperation};
let json = r#"{"kty":"oct","k":"c2VjcmV0LWtleS1tYXRlcmlhbC10aGF0LWlzLWxvbmctZW5vdWdo"}"#;
let key: Key = serde_json::from_str(json).unwrap();
// Validate for HMAC signing
assert!(key.validate_for_use(&Algorithm::Hs256, [KeyOperation::Sign]).is_ok());Sourcepub fn check_operations_permitted(
&self,
operations: impl AsRef<[KeyOperation]>,
) -> Result<()>
pub fn check_operations_permitted( &self, operations: impl AsRef<[KeyOperation]>, ) -> Result<()>
Checks whether this key’s metadata permits the requested operation(s).
This enforces RFC 7517 operation-intent semantics:
- If
useis present, it must be compatible with all requested operations. - If
key_opsis present, it must include all requested operations. - If both are present, they must be mutually consistent.
key_opsvalues must be unique.
Metadata members are optional in RFC 7517. If both use and key_ops
are absent, this check succeeds.
At least one operation must be provided. Passing an empty slice returns an error (this is a caller precondition, not a key problem).
This does not perform key-material or algorithm-suitability checks.
It does enforce use/key_ops metadata consistency (RFC 7517 §4.3),
which may return Error::InvalidKey if the key’s own metadata is
self-contradictory. Use Key::validate_for_use for the full pre-use
gate.
§Examples
use jwk_simple::{Key, KeyOperation};
let json = r#"{"kty":"oct","use":"sig","k":"c2VjcmV0LWtleS1tYXRlcmlhbC10aGF0LWlzLWxvbmctZW5vdWdo"}"#;
let key: Key = serde_json::from_str(json).unwrap();
// Signing is permitted by use="sig"
assert!(key.check_operations_permitted(&[KeyOperation::Sign]).is_ok());
// Encryption is not permitted by use="sig"
assert!(key.check_operations_permitted(&[KeyOperation::Encrypt]).is_err());Sourcepub fn is_algorithm_compatible(&self, alg: &Algorithm) -> bool
pub fn is_algorithm_compatible(&self, alg: &Algorithm) -> bool
Returns true if this key’s type (and curve, where applicable) is
compatible with the given algorithm per RFC 7518.
This checks that the key type matches what the algorithm requires. For example, an RSA key is compatible with RS256 but not with ES256. For EC keys, the curve is also checked (e.g., P-256 for ES256).
Unknown algorithms always return false since their requirements
cannot be determined.
§Examples
use jwk_simple::{Key, Algorithm};
let json = r#"{"kty":"RSA","n":"AQAB","e":"AQAB"}"#;
let key: Key = serde_json::from_str(json).unwrap();
assert!(key.is_algorithm_compatible(&Algorithm::Rs256));
assert!(!key.is_algorithm_compatible(&Algorithm::Es256));Sourcepub fn thumbprint(&self) -> String
pub fn thumbprint(&self) -> String
Calculates the JWK thumbprint (RFC 7638).
The thumbprint is a base64url-encoded SHA-256 hash of the key’s required members.
Sourcepub fn as_symmetric(&self) -> Option<&SymmetricParams>
pub fn as_symmetric(&self) -> Option<&SymmetricParams>
Returns the key as symmetric parameters, if applicable.
Sourcepub fn to_public(&self) -> Option<Key>
pub fn to_public(&self) -> Option<Key>
Extracts only the public key components, removing any private key material.
Public projection also normalizes key_ops to the subset that remains
meaningful for a public key (verify, encrypt, wrapKey). Operations
that require private or secret key material are removed.
For symmetric keys, this returns None since symmetric keys don’t have
a separate public component.
§Examples
use jwk_simple::KeySet;
let json = r#"{"keys": [{
"kty": "RSA",
"n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMstn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbISD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
"e": "AQAB",
"d": "X4cTteJY_gn4FYPsXB8rdXix5vwsg1FLN5E3EaG6RJoVH-HLLKD9M7dx5oo7GURknchnrRweUkC7hT5fJLM0WbFAKNLWY2vv7B6NqXSzUvxT0_YSfqijwp3RTzlBaCxWp4doFk5N2o8Gy_nHNKroADIkJ46pRUohsXywbReAdYaMwFs9tv8d_cPVY3i07a3t8MN6TNwm0dSawm9v47UiCl3Sk5ZiG7xojPLu4sbg1U2jx4IBTNBznbJSzFHK66jT8bgkuqsk0GjskDJk19Z4qwjwbsnn4j2WBii3RL-Us2lGVkY8fkFzme1z0HbIkfz0Y6mqnOYtqc0X4jfcKoAC8Q"
}]}"#;
let jwks: KeySet = serde_json::from_str(json).unwrap();
let private_key = jwks.first().unwrap();
// Extract public key
let public_key = private_key.to_public().expect("RSA keys have public components");
assert!(public_key.is_public_key_only());Trait Implementations§
Source§impl<'de> Deserialize<'de> for Key
impl<'de> Deserialize<'de> for Key
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Source§impl PartialEq for Key
Equality is based on the key type, key ID, use, operations, algorithm,
and key material parameters. X.509 certificate fields (x5c, x5t,
x5t#S256, x5u) are not compared, because two representations
of the same cryptographic key may carry different certificate metadata.
impl PartialEq for Key
Equality is based on the key type, key ID, use, operations, algorithm,
and key material parameters. X.509 certificate fields (x5c, x5t,
x5t#S256, x5u) are not compared, because two representations
of the same cryptographic key may carry different certificate metadata.
§Security Note
This comparison is not constant-time. It uses short-circuit
byte-by-byte comparison of key material, including private key
components. Do not use == on Key values in security-sensitive
decisions where one side is attacker-controlled, as timing differences
may leak information about secret key material (CWE-208).
For constant-time comparison of symmetric key material, use
SymmetricParams::ct_eq. For the underlying byte buffers, use
Base64UrlBytes::ct_eq.
Source§impl TryFrom<&Key> for ES256KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for ES256KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for ES256PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for ES256PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for ES256kKeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for ES256kKeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for ES256kPublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for ES256kPublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for ES384KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for ES384KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for ES384PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for ES384PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for Ed25519KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for Ed25519KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for Ed25519PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for Ed25519PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for HS256Key
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for HS256Key
jwt-simple only.Source§fn try_from(jwk: &Key) -> Result<Self, JwtSimpleKeyConversionError>
fn try_from(jwk: &Key) -> Result<Self, JwtSimpleKeyConversionError>
§Errors
Returns JwtSimpleKeyConversionError::IncompatibleKey if key_ops is
present but does not include both KeyOperation::Sign and
KeyOperation::Verify. HS256Key in jwt-simple is bidirectional;
callers that need one-directional HMAC usage should remove key_ops
before converting.
Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for HS384Key
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for HS384Key
jwt-simple only.Source§fn try_from(jwk: &Key) -> Result<Self, JwtSimpleKeyConversionError>
fn try_from(jwk: &Key) -> Result<Self, JwtSimpleKeyConversionError>
§Errors
Returns JwtSimpleKeyConversionError::IncompatibleKey if key_ops is
present but does not include both KeyOperation::Sign and
KeyOperation::Verify. HS384Key in jwt-simple is bidirectional;
callers that need one-directional HMAC usage should remove key_ops
before converting.
Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for HS512Key
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for HS512Key
jwt-simple only.Source§fn try_from(jwk: &Key) -> Result<Self, JwtSimpleKeyConversionError>
fn try_from(jwk: &Key) -> Result<Self, JwtSimpleKeyConversionError>
§Errors
Returns JwtSimpleKeyConversionError::IncompatibleKey if key_ops is
present but does not include both KeyOperation::Sign and
KeyOperation::Verify. HS512Key in jwt-simple is bidirectional;
callers that need one-directional HMAC usage should remove key_ops
before converting.
Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for JsonWebKey
Available on crate feature web-crypto and WebAssembly only.Conversion from Key to web_sys::JsonWebKey for WebCrypto usage.
impl TryFrom<&Key> for JsonWebKey
web-crypto and WebAssembly only.Conversion from Key to web_sys::JsonWebKey for WebCrypto usage.
§Supported Key Types
- RSA: All RSA keys are supported
- EC: P-256, P-384, P-521 curves are supported; secp256k1 is NOT supported
- Symmetric: All symmetric keys are supported
- OKP: NOT supported (Ed25519, Ed448, X25519, X448)
§Errors
Returns Error::UnsupportedForWebCrypto if the key type or curve is not
supported by WebCrypto.
§Examples
use jwk_simple::Key;
use std::convert::TryInto;
let key: Key = serde_json::from_str(r#"{"kty":"RSA","n":"...","e":"AQAB"}"#)?;
let jwk: web_sys::JsonWebKey = (&key).try_into()?;
assert_eq!(jwk.get_kty(), "RSA");Source§impl TryFrom<&Key> for PS256KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for PS256KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for PS256PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for PS256PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for PS384KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for PS384KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for PS384PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for PS384PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for PS512KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for PS512KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for PS512PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for PS512PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for RS256KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for RS256KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for RS256PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for RS256PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for RS384KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for RS384KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for RS384PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for RS384PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for RS512KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for RS512KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<&Key> for RS512PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<&Key> for RS512PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for ES256KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for ES256KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for ES256PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for ES256PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for ES256kKeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for ES256kKeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for ES256kPublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for ES256kPublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for ES384KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for ES384KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for ES384PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for ES384PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for Ed25519KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for Ed25519KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for Ed25519PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for Ed25519PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for HS256Key
Available on crate feature jwt-simple only.
impl TryFrom<Key> for HS256Key
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for HS384Key
Available on crate feature jwt-simple only.
impl TryFrom<Key> for HS384Key
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for HS512Key
Available on crate feature jwt-simple only.
impl TryFrom<Key> for HS512Key
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for PS256KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for PS256KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for PS256PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for PS256PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for PS384KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for PS384KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for PS384PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for PS384PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for PS512KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for PS512KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for PS512PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for PS512PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for RS256KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for RS256KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for RS256PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for RS256PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for RS384KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for RS384KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for RS384PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for RS384PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for RS512KeyPair
Available on crate feature jwt-simple only.
impl TryFrom<Key> for RS512KeyPair
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
Source§impl TryFrom<Key> for RS512PublicKey
Available on crate feature jwt-simple only.
impl TryFrom<Key> for RS512PublicKey
jwt-simple only.Source§type Error = JwtSimpleKeyConversionError
type Error = JwtSimpleKeyConversionError
impl Eq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.