subtle.generateKey(algorithm, extractable, keyUsages)


使用 algorithm 中提供的方法和参数,subtle.generateKey() 尝试生成新的密钥材料。根据使用的方法,该方法可能生成单个 <CryptoKey><CryptoKeyPair>

【Using the method and parameters provided in algorithm, subtle.generateKey() attempts to generate new keying material. Depending the method used, the method may generate either a single <CryptoKey> or a <CryptoKeyPair>.】

支持的 <CryptoKeyPair>(公钥和私钥)生成算法包括:

【The <CryptoKeyPair> (public and private key) generating algorithms supported include:】

  • 'RSASSA-PKCS1-v1_5'
  • 'RSA-PSS'
  • 'RSA-OAEP'
  • 'ECDSA'
  • 'Ed25519'
  • 'Ed448' 1
  • 'ECDH'
  • 'X25519'
  • 'X448' 1

支持的 <CryptoKey>(密钥)生成算法包括:

【The <CryptoKey> (secret key) generating algorithms supported include:】

  • 'HMAC'
  • 'AES-CTR'
  • 'AES-CBC'
  • 'AES-GCM'
  • 'AES-KW'