pub struct Jwk {
pub kty: String,
pub crv: Option<String>,
pub x: Option<String>,
pub y: Option<String>,
pub n: Option<String>,
pub e: Option<String>,
pub alg: Option<String>,
pub kid: Option<String>,
pub use_: Option<String>,
}Expand description
A public JWK. Private members are never read or written.
Fields§
§kty: StringKey type: OKP, EC or RSA.
crv: Option<String>Curve: Ed25519 or P-256.
x: Option<String>The public key (OKP), or its x coordinate (EC).
y: Option<String>An EC key’s y coordinate.
n: Option<String>An RSA key’s modulus.
e: Option<String>An RSA key’s exponent.
alg: Option<String>The fully-specified algorithm the key signs with. Required to verify.
kid: Option<String>The key’s identifier in its JWKS.
use_: Option<String>sig for a signing key.
Implementations§
Source§impl Jwk
impl Jwk
Sourcepub fn thumbprint(&self) -> Result<String>
pub fn thumbprint(&self) -> Result<String>
RFC 7638: the required members, lexicographically ordered, no whitespace.
Sourcepub fn algorithm(&self) -> Result<Algorithm, KeyProblem>
pub fn algorithm(&self) -> Result<Algorithm, KeyProblem>
The algorithm this key signs with, from its alg member, checked
against its key material.
Sourcepub fn verify(
&self,
algorithm: Algorithm,
message: &[u8],
signature: &[u8],
) -> bool
pub fn verify( &self, algorithm: Algorithm, message: &[u8], signature: &[u8], ) -> bool
Whether signature is this key’s, under algorithm, over message.
ES256 signatures are the raw 64-byte r || s both JWS and RFC 9421 use.
Sourcepub fn check_confirmation_key(&self) -> Result<()>
pub fn check_confirmation_key(&self) -> Result<()>
The structural checks on a token’s cnf.jwk (AAuth §Request-Context
Binding), before it is decoded.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Jwk
impl<'de> Deserialize<'de> for Jwk
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Jwk
impl StructuralPartialEq for Jwk
Auto Trait Implementations§
impl Freeze for Jwk
impl RefUnwindSafe for Jwk
impl Send for Jwk
impl Sync for Jwk
impl Unpin for Jwk
impl UnsafeUnpin for Jwk
impl UnwindSafe for Jwk
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