pub struct Hmac<D> { /* private fields */ }Available on crate feature 
hmac only.Expand description
The HMAC algorithm as used when signing a JWS.
This type exists to associate the original key value with the digest.
This is required for verification, and for the jwk field in the JWS header,
if that field is enabled.
Implementations§
Trait Implementations§
Source§impl<D> DeserializeJWK for Hmac<D>
 
impl<D> DeserializeJWK for Hmac<D>
Source§fn build(parameters: BTreeMap<String, Value>) -> Result<Self, JsonWebKeyError>
 
fn build(parameters: BTreeMap<String, Value>) -> Result<Self, JsonWebKeyError>
From a set of parameters, build a key.
Source§fn from_jwk(jwk: &JsonWebKey) -> Result<Self, JsonWebKeyError>
 
fn from_jwk(jwk: &JsonWebKey) -> Result<Self, JsonWebKeyError>
Build a concrete key type from 
JsonWebKey.Source§fn from_value(value: Value) -> Result<Self, JsonWebKeyError>
 
fn from_value(value: Value) -> Result<Self, JsonWebKeyError>
Deserialize a concrete key type from a JSON value.
Source§impl JsonWebAlgorithm for Hmac<Sha256>
 
impl JsonWebAlgorithm for Hmac<Sha256>
Source§const IDENTIFIER: AlgorithmIdentifier = crate::algorithms::AlgorithmIdentifier::HS256
 
const IDENTIFIER: AlgorithmIdentifier = crate::algorithms::AlgorithmIdentifier::HS256
The identifier for this algorithm when used in a JWT registered header. Read more
Source§impl JsonWebAlgorithm for Hmac<Sha512>
 
impl JsonWebAlgorithm for Hmac<Sha512>
Source§const IDENTIFIER: AlgorithmIdentifier = crate::algorithms::AlgorithmIdentifier::HS512
 
const IDENTIFIER: AlgorithmIdentifier = crate::algorithms::AlgorithmIdentifier::HS512
The identifier for this algorithm when used in a JWT registered header. Read more
Source§impl JsonWebAlgorithm for Hmac<Sha384>
 
impl JsonWebAlgorithm for Hmac<Sha384>
Source§const IDENTIFIER: AlgorithmIdentifier = crate::algorithms::AlgorithmIdentifier::HS384
 
const IDENTIFIER: AlgorithmIdentifier = crate::algorithms::AlgorithmIdentifier::HS384
The identifier for this algorithm when used in a JWT registered header. Read more
Source§impl<D> Keypair for Hmac<D>
 
impl<D> Keypair for Hmac<D>
Source§type VerifyingKey = Hmac<D>
 
type VerifyingKey = Hmac<D>
Verifying key type for this keypair.
Source§fn verifying_key(&self) -> Self::VerifyingKey
 
fn verifying_key(&self) -> Self::VerifyingKey
Get the verifying key which can verify signatures produced by the
signing key portion of this keypair.
Source§impl<D> SerializeJWK for Hmac<D>
 
impl<D> SerializeJWK for Hmac<D>
Source§impl<D> TokenSigner<DigestSignature<D>> for Hmac<D>
 
impl<D> TokenSigner<DigestSignature<D>> for Hmac<D>
Source§fn try_sign_token(
    &self,
    header: &str,
    payload: &str,
) -> Result<DigestSignature<D>, Error>
 
fn try_sign_token( &self, header: &str, payload: &str, ) -> Result<DigestSignature<D>, Error>
Sign the contents of the JWT, when provided with the base64url-encoded header
and payload. The header and payload are already serialized to JSON and then
base64url-encoded, so this function should not perform any additional encoding. Read more
Source§fn sign_token(&self, header: &str, payload: &str) -> S
 
fn sign_token(&self, header: &str, payload: &str) -> S
Sign the contents of the JWT, when provided with the base64url-encoded header
and payload. See 
TokenSigner::try_sign_token for more details. Read moreSource§impl<D> TokenSigner for Hmac<D>
 
impl<D> TokenSigner for Hmac<D>
Source§fn try_sign_token(
    &self,
    header: &str,
    payload: &str,
) -> Result<SignatureBytes, Error>
 
fn try_sign_token( &self, header: &str, payload: &str, ) -> Result<SignatureBytes, Error>
Sign the contents of the JWT, when provided with the base64url-encoded header
and payload. The header and payload are already serialized to JSON and then
base64url-encoded, so this function should not perform any additional encoding. Read more
Source§fn sign_token(&self, header: &str, payload: &str) -> S
 
fn sign_token(&self, header: &str, payload: &str) -> S
Sign the contents of the JWT, when provided with the base64url-encoded header
and payload. See 
TokenSigner::try_sign_token for more details. Read moreSource§impl<D> TokenVerifier<DigestSignature<D>> for Hmac<D>
 
impl<D> TokenVerifier<DigestSignature<D>> for Hmac<D>
Source§fn verify_token(
    &self,
    header: &[u8],
    payload: &[u8],
    signature: &[u8],
) -> Result<DigestSignature<D>, Error>
 
fn verify_token( &self, header: &[u8], payload: &[u8], signature: &[u8], ) -> Result<DigestSignature<D>, Error>
Verify the signature of the JWT, when provided with the base64url-encoded header
and payload, along side the signature. The header and payload are already encoded,
so this function should not perform any additional encoding. Read more
Source§impl<D> TokenVerifier for Hmac<D>
 
impl<D> TokenVerifier for Hmac<D>
Source§fn verify_token(
    &self,
    header: &[u8],
    payload: &[u8],
    signature: &[u8],
) -> Result<SignatureBytes, Error>
 
fn verify_token( &self, header: &[u8], payload: &[u8], signature: &[u8], ) -> Result<SignatureBytes, Error>
Verify the signature of the JWT, when provided with the base64url-encoded header
and payload, along side the signature. The header and payload are already encoded,
so this function should not perform any additional encoding. Read more
Auto Trait Implementations§
impl<D> Freeze for Hmac<D>
impl<D> RefUnwindSafe for Hmac<D>where
    D: RefUnwindSafe,
impl<D> Send for Hmac<D>where
    D: Send,
impl<D> Sync for Hmac<D>where
    D: Sync,
impl<D> Unpin for Hmac<D>where
    D: Unpin,
impl<D> UnwindSafe for Hmac<D>where
    D: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<T> DynJsonWebAlgorithm for Twhere
    T: JsonWebAlgorithm,
 
impl<T> DynJsonWebAlgorithm for Twhere
    T: JsonWebAlgorithm,
Source§fn identifier(&self) -> AlgorithmIdentifier
 
fn identifier(&self) -> AlgorithmIdentifier
The identifier for this algorithm when used in a JWT registered header.