You need to enable JavaScript to run this app.
导航
importKey/exportKey/generateKey
最近更新时间:2024.04.09 14:14:16首次发布时间:2023.02.15 19:04:53

介绍

该接口用于密钥导入,导出、以及随机生成,详细定义及用法参见MDN官方文档importKeyexportKeygenerateKey

算法

  • RSA
  • HMAC
  • AES
  • ECDSA

示例

async function handle() {
  var algorithm = {name: "HMAC", hash: {name: "SHA-512"}};
  var key = await crypto.subtle.generateKey(algorithm, 
      true, ['sign', 'verify']);
  var raw_key = await crypto.subtle.exportKey("Raw", key);
  var import_key = await crypto.subtle.importKey("Raw", raw_key, algorithm, 
      true, ['sign', 'verify']);
}