Enum JwsAlgorithm
pub enum JwsAlgorithm {
ES256,
ES384,
ES512,
EdDSA,
}Expand description
Narrows the supported signature algorithms to the ones we define
Variants§
ES256
ECDSA using P-256 and SHA-256
Specified in RFC 7518 Section 3.4: Digital Signature with ECDSA
ES384
ECDSA using P-384 and SHA-384
Specified in RFC 7518 Section 3.4: Digital Signature with ECDSA
ES512
ECDSA using P-521 and SHA-512
Specified in RFC 7518 Section 3.4: Digital Signature with ECDSA
EdDSA
Implementations§
§impl JwsAlgorithm
impl JwsAlgorithm
pub fn encoding_key(self, pem: &Pem) -> Result<EncodingKey, Error>
pub fn encoding_key(self, pem: &Pem) -> Result<EncodingKey, Error>
Parses a PEM encoded private key for signing with this algorithm
pub fn public_jwk(self, kp: &Pem) -> Result<Jwk, RustyJwtError>
pub fn public_jwk(self, kp: &Pem) -> Result<Jwk, RustyJwtError>
Builds the public JWK of a PEM encoded key pair for this algorithm
§impl JwsAlgorithm
impl JwsAlgorithm
pub fn generate_keypair(self) -> Result<Pem, RustyJwtError>
pub fn generate_keypair(self) -> Result<Pem, RustyJwtError>
Generates a new key pair for this algorithm, PEM encoded
pub fn keypair_from_bytes(self, bytes: &[u8]) -> Result<Pem, RustyJwtError>
pub fn keypair_from_bytes(self, bytes: &[u8]) -> Result<Pem, RustyJwtError>
PEM encodes a raw private key of this algorithm
For ECDSA, bytes is the big-endian scalar. For EdDSA, it is the 32 byte seed.
pub fn keypair_to_bytes(
self,
kp: &Pem,
) -> Result<Zeroizing<Vec<u8>>, RustyJwtError>
pub fn keypair_to_bytes( self, kp: &Pem, ) -> Result<Zeroizing<Vec<u8>>, RustyJwtError>
Returns the raw private key of a PEM encoded key pair of this algorithm
This is the inverse of JwsAlgorithm::keypair_from_bytes.
Trait Implementations§
§impl Clone for JwsAlgorithm
impl Clone for JwsAlgorithm
§fn clone(&self) -> JwsAlgorithm
fn clone(&self) -> JwsAlgorithm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for JwsAlgorithm
§impl Debug for JwsAlgorithm
impl Debug for JwsAlgorithm
§impl<'de> Deserialize<'de> for JwsAlgorithm
impl<'de> Deserialize<'de> for JwsAlgorithm
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JwsAlgorithm, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JwsAlgorithm, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Display for JwsAlgorithm
impl Display for JwsAlgorithm
impl Eq for JwsAlgorithm
§impl From<JwsAlgorithm> for HashAlgorithm
According to MLS defined ciphersuites
impl From<JwsAlgorithm> for HashAlgorithm
According to MLS defined ciphersuites
§fn from(alg: JwsAlgorithm) -> HashAlgorithm
fn from(alg: JwsAlgorithm) -> HashAlgorithm
§impl PartialEq for JwsAlgorithm
impl PartialEq for JwsAlgorithm
§impl Serialize for JwsAlgorithm
impl Serialize for JwsAlgorithm
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for JwsAlgorithm
§impl TryFrom<&str> for JwsAlgorithm
impl TryFrom<&str> for JwsAlgorithm
§impl TryFrom<Algorithm> for JwsAlgorithm
impl TryFrom<Algorithm> for JwsAlgorithm
§fn try_from(
value: Algorithm,
) -> Result<JwsAlgorithm, <JwsAlgorithm as TryFrom<Algorithm>>::Error>
fn try_from( value: Algorithm, ) -> Result<JwsAlgorithm, <JwsAlgorithm as TryFrom<Algorithm>>::Error>
Auto Trait Implementations§
impl Freeze for JwsAlgorithm
impl RefUnwindSafe for JwsAlgorithm
impl Send for JwsAlgorithm
impl Sync for JwsAlgorithm
impl Unpin for JwsAlgorithm
impl UnsafeUnpin for JwsAlgorithm
impl UnwindSafe for JwsAlgorithm
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.