File tree Expand file tree Collapse file tree 3 files changed +3
-0
lines changed
web-crypto/encrypt-decrypt Expand file tree Collapse file tree 3 files changed +3
-0
lines changed Original file line number Diff line number Diff line change 23
23
*/
24
24
async function encryptMessage ( key ) {
25
25
let encoded = getMessageEncoding ( ) ;
26
+ // The iv must never be reused with a given key.
26
27
iv = window . crypto . getRandomValues ( new Uint8Array ( 16 ) ) ;
27
28
ciphertext = await window . crypto . subtle . encrypt (
28
29
{
Original file line number Diff line number Diff line change 23
23
*/
24
24
async function encryptMessage ( key ) {
25
25
let encoded = getMessageEncoding ( ) ;
26
+ // The counter block value must never be reused with a given key.
26
27
counter = window . crypto . getRandomValues ( new Uint8Array ( 16 ) ) ,
27
28
ciphertext = await window . crypto . subtle . encrypt (
28
29
{
Original file line number Diff line number Diff line change 23
23
*/
24
24
async function encryptMessage ( key ) {
25
25
let encoded = getMessageEncoding ( ) ;
26
+ // The iv must never be reused with a given key.
26
27
iv = window . crypto . getRandomValues ( new Uint8Array ( 12 ) ) ;
27
28
ciphertext = await window . crypto . subtle . encrypt (
28
29
{
You can’t perform that action at this time.
0 commit comments