pub struct HS256 { /* private fields */ }
Available on crate feature
hmac-sha2
only.Expand description
HMAC using SHA2-256.
This algorithm is required to be implemented (i.e. available) according to
section 3.1 of RFC 7518,
but jwt2
does not enforce this requirement.
In the terms of RFCs this crate treats HS256
’s “Required” as a “Recommended”.
Implementations§
Source§impl HS256
impl HS256
Sourcepub fn new(key: &[u8]) -> Result<Self, ConstructError>
pub fn new(key: &[u8]) -> Result<Self, ConstructError>
Creates a HS256 instance.
See the security considerations of this module.
Source§impl HS256
impl HS256
Sourcepub fn generate_key<R>(rng: &mut R) -> Vec<u8> ⓘwhere
R: CryptoRngCore,
Available on crate feature rand
only.
pub fn generate_key<R>(rng: &mut R) -> Vec<u8> ⓘwhere
R: CryptoRngCore,
rand
only.Generates a suitable key for this algorithm.
Trait Implementations§
Source§impl JwsVerifier for HS256
impl JwsVerifier for HS256
Source§impl RecommendHeaderParams for HS256
impl RecommendHeaderParams for HS256
Source§impl ValidateHeaderParams for HS256
impl ValidateHeaderParams for HS256
Source§fn validate_header(&self, header: &Header) -> bool
fn validate_header(&self, header: &Header) -> bool
Check that the header is supported by this verifier.
Auto Trait Implementations§
impl Freeze for HS256
impl RefUnwindSafe for HS256
impl Send for HS256
impl Sync for HS256
impl Unpin for HS256
impl UnwindSafe for HS256
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