Struct jwt_compact::alg::Es256k
source · pub struct Es256k<D = Sha256> { /* private fields */ }Available on crate features
es256k or k256 only.Expand description
Algorithm implementing elliptic curve digital signatures (ECDSA) on the secp256k1 curve.
The algorithm does not fix the choice of the message digest algorithm; instead, it is provided as a type parameter. SHA-256 is the default parameter value, but it can be set to any cryptographically secure hash function with 32-byte output (e.g., SHA3-256).
Implementations§
Trait Implementations§
source§impl<D> Algorithm for Es256k<D>where
D: FixedOutputReset<OutputSize = U32> + BlockSizeUser + Clone + Default + HashMarker,
impl<D> Algorithm for Es256k<D>where D: FixedOutputReset<OutputSize = U32> + BlockSizeUser + Clone + Default + HashMarker,
§type SigningKey = SecretKey
type SigningKey = SecretKey
Key used when issuing new tokens.
§type VerifyingKey = PublicKey
type VerifyingKey = PublicKey
Key used when verifying tokens. May coincide with
Self::SigningKey for symmetric
algorithms (e.g., HS*).source§fn name(&self) -> Cow<'static, str>
fn name(&self) -> Cow<'static, str>
Returns the name of this algorithm, as mentioned in the
alg field of the JWT header.source§fn sign(
&self,
signing_key: &Self::SigningKey,
message: &[u8]
) -> Self::Signature
fn sign( &self, signing_key: &Self::SigningKey, message: &[u8] ) -> Self::Signature
Signs a
message with the signing_key.source§fn verify_signature(
&self,
signature: &Self::Signature,
verifying_key: &Self::VerifyingKey,
message: &[u8]
) -> bool
fn verify_signature( &self, signature: &Self::Signature, verifying_key: &Self::VerifyingKey, message: &[u8] ) -> bool
Verifies the
message against the signature and verifying_key.