summaryrefslogtreecommitdiff
path: root/ext/crypto/key.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/crypto/key.rs')
-rw-r--r--ext/crypto/key.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/crypto/key.rs b/ext/crypto/key.rs
index 663217887..d55a1d062 100644
--- a/ext/crypto/key.rs
+++ b/ext/crypto/key.rs
@@ -2,6 +2,7 @@
use ring::agreement::Algorithm as RingAlgorithm;
use ring::digest;
+use ring::hkdf;
use ring::hmac::Algorithm as HmacAlgorithm;
use ring::signature::EcdsaSigningAlgorithm;
use ring::signature::EcdsaVerificationAlgorithm;
@@ -89,6 +90,14 @@ impl From<CryptoHash> for &'static digest::Algorithm {
}
}
+pub struct HkdfOutput<T>(pub T);
+
+impl hkdf::KeyType for HkdfOutput<usize> {
+ fn len(&self) -> usize {
+ self.0
+ }
+}
+
#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq)]
#[serde(rename_all = "camelCase")]
pub enum KeyUsage {
@@ -126,4 +135,6 @@ pub enum Algorithm {
Hmac,
#[serde(rename = "PBKDF2")]
Pbkdf2,
+ #[serde(rename = "HKDF")]
+ Hkdf,
}