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
impl Jwk
Sourcepub fn to_key_for(&self, alg: Algorithm) -> Result<Key>
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<'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
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> 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