|
@@ -11,6 +11,12 @@ const code = `
|
11
|
11
|
// packet. See https://developer.mozilla.org/en-US/docs/Web/API/AesGcmParams
|
12
|
12
|
const ivLength = 12;
|
13
|
13
|
|
|
14
|
+ // We use a 128 bit key for AES GCM.
|
|
15
|
+ const keyGenParameters = {
|
|
16
|
+ name: 'AES-GCM',
|
|
17
|
+ length: 128
|
|
18
|
+ };
|
|
19
|
+
|
14
|
20
|
// We copy the first bytes of the VP8 payload unencrypted.
|
15
|
21
|
// For keyframes this is 10 bytes, for non-keyframes (delta) 3. See
|
16
|
22
|
// https://tools.ietf.org/html/rfc6386#section-9.1
|
|
@@ -39,7 +45,8 @@ const code = `
|
39
|
45
|
let keyBytes;
|
40
|
46
|
|
41
|
47
|
/**
|
42
|
|
- * Derives a AES-GCM key with 128 bits from the input using PBKDF2
|
|
48
|
+ * Derives a AES-GCM key from the input using PBKDF2
|
|
49
|
+ * The key length can be configured above and should be either 128 or 256 bits.
|
43
|
50
|
* @param {Uint8Array} keyBytes - Value to derive key from
|
44
|
51
|
* @param {Uint8Array} salt - Salt used in key derivation
|
45
|
52
|
*/
|
|
@@ -54,10 +61,7 @@ const code = `
|
54
|
61
|
salt,
|
55
|
62
|
iterations: 100000,
|
56
|
63
|
hash: 'SHA-256'
|
57
|
|
- }, material, {
|
58
|
|
- name: 'AES-GCM',
|
59
|
|
- length: 128
|
60
|
|
- }, false, [ 'encrypt', 'decrypt' ]);
|
|
64
|
+ }, material, keyGenParameters, false, [ 'encrypt', 'decrypt' ]);
|
61
|
65
|
}
|
62
|
66
|
|
63
|
67
|
|