Jwk

Struct Jwk 

Source
pub struct Jwk {
Show 16 fields pub kty: String, pub kid: Option<String>, pub alg: Option<String>, pub use_: Option<String>, pub n: Option<String>, pub e: Option<String>, pub d: Option<String>, pub p: Option<String>, pub q: Option<String>, pub dp: Option<String>, pub dq: Option<String>, pub qi: Option<String>, pub crv: Option<String>, pub x: Option<String>, pub y: Option<String>, pub k: Option<String>,
}
Expand description

JSON Web Key (JWK) representation

Fields§

§kty: String

Key type (e.g., “RSA”, “EC”, “OKP”, “oct”)

§kid: Option<String>

Key ID

§alg: Option<String>

Algorithm

§use_: Option<String>

Key use

§n: Option<String>

RSA modulus

§e: Option<String>

RSA exponent

§d: Option<String>

Private exponent (RSA, EC, OKP)

§p: Option<String>

RSA first prime factor

§q: Option<String>

RSA second prime factor

§dp: Option<String>

RSA first factor CRT exponent

§dq: Option<String>

RSA second factor CRT exponent

§qi: Option<String>

RSA first CRT coefficient

§crv: Option<String>

Curve name (EC, OKP)

§x: Option<String>

X coordinate (EC, OKP)

§y: Option<String>

Y coordinate (EC)

§k: Option<String>

Octet key value

Implementations§

Source§

impl Jwk

Source

pub fn to_key_for(&self, alg: Algorithm) -> Result<Key>

Convert this JWK to a Key for the given algorithm

§Arguments
  • alg - The algorithm to use for key conversion
§Returns

Returns a Result containing the converted key or an error

§Errors
  • Error::Key if the JWK is invalid or conversion fails
§Note

Currently only supports octet keys (HMAC). RSA, EC, and EdDSA JWK to PEM conversion is not implemented and will return an error.

Trait Implementations§

Source§

impl Clone for Jwk

Source§

fn clone(&self) -> Jwk

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Jwk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Jwk

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Jwk

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Jwk

§

impl RefUnwindSafe for Jwk

§

impl Send for Jwk

§

impl Sync for Jwk

§

impl Unpin for Jwk

§

impl UnwindSafe for Jwk

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,