summaryrefslogtreecommitdiff
path: root/ext/crypto/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'ext/crypto/lib.rs')
-rw-r--r--ext/crypto/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/crypto/lib.rs b/ext/crypto/lib.rs
index b68bd7887..7c4010f53 100644
--- a/ext/crypto/lib.rs
+++ b/ext/crypto/lib.rs
@@ -180,6 +180,18 @@ pub async fn op_crypto_generate_key(
private_key
}
+ Algorithm::AesCtr
+ | Algorithm::AesCbc
+ | Algorithm::AesGcm
+ | Algorithm::AesKw => {
+ let length = args.length.ok_or_else(not_supported)?;
+ let mut key_data = vec![0u8; length];
+ let rng = RingRand::SystemRandom::new();
+ rng.fill(&mut key_data).map_err(|_| {
+ custom_error("DOMExceptionOperationError", "Key generation failed")
+ })?;
+ key_data
+ }
Algorithm::Hmac => {
let hash: HmacAlgorithm = args.hash.ok_or_else(not_supported)?.into();