1 回答

TA貢獻1900條經驗 獲得超5個贊
從技術上講,ascrypto.subtle.deriveKey提供了一個密鑰,可用于根據RFC 3394包裝另一個密鑰,另請參閱。因為這必須用作代替,另請參見此示例 ( )。name: 'AES-KW'derivedKeyAlgorithmAES-KW['wrapKey', 'unwrapKey']keyUsages['encrypt', 'decrypt']getKey
提供了name: 'AES-GCM'asderivedKeyAlgorithm和['encrypt', 'decrypt']askeyUsages密鑰,可用于使用AES-GCM進行加密和解密。
示例AES-KW:
crypto.subtle.generateKey(
{ name: 'ECDH', namedCurve: 'P-521' },
true,
['deriveKey']
).then(function(keypair){
crypto.subtle.deriveKey(
{ name: 'ECDH', public: keypair.publicKey }, // In practice, this is the public key of the recipient
keypair.privateKey, // In practice, this is the own private key
{ name: 'AES-KW', length: 256 },
true,
["wrapKey", "unwrapKey"],
).then(function(wrappingKey){
console.log(wrappingKey);
})
})
添加回答
舉報