pub enum KeyManagementAlgorithm {
Show 17 variants
RSA1_5,
RSA_OAEP,
RSA_OAEP_256,
A128KW,
A192KW,
A256KW,
DirectSymmetricKey,
ECDH_ES,
ECDH_ES_A128KW,
ECDH_ES_A192KW,
ECDH_ES_A256KW,
A128GCMKW,
A192GCMKW,
A256GCMKW,
PBES2_HS256_A128KW,
PBES2_HS384_A192KW,
PBES2_HS512_A256KW,
}
Expand description
Algorithms for key management as defined in RFC7518#4
Variants§
RSA1_5
RSAES-PKCS1-v1_5
RSA_OAEP
RSAES OAEP using default parameters
RSA_OAEP_256
RSAES OAEP using SHA-256 and MGF1 with SHA-256
A128KW
AES Key Wrap using 128-bit key. Unsupported
A192KW
AES Key Wrap using 192-bit key. Unsupported.
This is not supported by ring
.
A256KW
AES Key Wrap using 256-bit key. Unsupported
DirectSymmetricKey
Direct use of a shared symmetric key
ECDH_ES
ECDH-ES using Concat KDF
ECDH_ES_A128KW
ECDH-ES using Concat KDF and “A128KW” wrapping
ECDH_ES_A192KW
ECDH-ES using Concat KDF and “A192KW” wrapping
ECDH_ES_A256KW
ECDH-ES using Concat KDF and “A256KW” wrapping
A128GCMKW
Key wrapping with AES GCM using 128-bit key alg
A192GCMKW
Key wrapping with AES GCM using 192-bit key alg.
This is not supported by ring
.
A256GCMKW
Key wrapping with AES GCM using 256-bit key alg
PBES2_HS256_A128KW
PBES2 with HMAC SHA-256 and “A128KW” wrapping
PBES2_HS384_A192KW
PBES2 with HMAC SHA-384 and “A192KW” wrapping
PBES2_HS512_A256KW
PBES2 with HMAC SHA-512 and “A256KW” wrapping
Implementations§
Source§impl KeyManagementAlgorithm
impl KeyManagementAlgorithm
Sourcepub fn algorithm_type(self) -> KeyManagementAlgorithmType
pub fn algorithm_type(self) -> KeyManagementAlgorithmType
Returns the type of operations that the algorithm is intended to support
Sourcepub fn cek<T>(
self,
content_alg: ContentEncryptionAlgorithm,
key: &JWK<T>,
) -> Result<JWK<Empty>, Error>where
T: Serialize + DeserializeOwned,
pub fn cek<T>(
self,
content_alg: ContentEncryptionAlgorithm,
key: &JWK<T>,
) -> Result<JWK<Empty>, Error>where
T: Serialize + DeserializeOwned,
Return the Content Encryption Key (CEK) based on the key management algorithm
If the algorithm is dir
or DirectSymmetricKey
, the key provided is the CEK.
Otherwise, the appropriate algorithm will be used to derive or generate the required CEK
using the provided key.
Sourcepub fn wrap_key<T>(
self,
payload: &[u8],
key: &JWK<T>,
options: &EncryptionOptions,
) -> Result<EncryptionResult, Error>where
T: Serialize + DeserializeOwned,
pub fn wrap_key<T>(
self,
payload: &[u8],
key: &JWK<T>,
options: &EncryptionOptions,
) -> Result<EncryptionResult, Error>where
T: Serialize + DeserializeOwned,
Encrypt or wrap a Content Encryption Key with the provided algorithm
Sourcepub fn unwrap_key<T>(
self,
encrypted: &EncryptionResult,
content_alg: ContentEncryptionAlgorithm,
key: &JWK<T>,
) -> Result<JWK<Empty>, Error>where
T: Serialize + DeserializeOwned,
pub fn unwrap_key<T>(
self,
encrypted: &EncryptionResult,
content_alg: ContentEncryptionAlgorithm,
key: &JWK<T>,
) -> Result<JWK<Empty>, Error>where
T: Serialize + DeserializeOwned,
Decrypt or unwrap a CEK with the provided algorithm
Trait Implementations§
Source§impl Clone for KeyManagementAlgorithm
impl Clone for KeyManagementAlgorithm
Source§fn clone(&self) -> KeyManagementAlgorithm
fn clone(&self) -> KeyManagementAlgorithm
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for KeyManagementAlgorithm
impl Debug for KeyManagementAlgorithm
Source§impl Default for KeyManagementAlgorithm
impl Default for KeyManagementAlgorithm
Source§fn default() -> KeyManagementAlgorithm
fn default() -> KeyManagementAlgorithm
Source§impl<'de> Deserialize<'de> for KeyManagementAlgorithm
impl<'de> Deserialize<'de> for KeyManagementAlgorithm
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyManagementAlgorithm, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyManagementAlgorithm, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for KeyManagementAlgorithm
impl PartialEq for KeyManagementAlgorithm
Source§impl Serialize for KeyManagementAlgorithm
impl Serialize for KeyManagementAlgorithm
Source§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 Copy for KeyManagementAlgorithm
impl Eq for KeyManagementAlgorithm
impl StructuralPartialEq for KeyManagementAlgorithm
Auto Trait Implementations§
impl Freeze for KeyManagementAlgorithm
impl RefUnwindSafe for KeyManagementAlgorithm
impl Send for KeyManagementAlgorithm
impl Sync for KeyManagementAlgorithm
impl Unpin for KeyManagementAlgorithm
impl UnwindSafe for KeyManagementAlgorithm
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.