subtle.generateKey(algorithm, extractable, keyUsages)


使用 algorithm 中提供的参数,该方法尝试生成新的密钥材料。根据所使用的算法,将生成单个 <CryptoKey><CryptoKeyPair>

【Using the parameters provided in algorithm, this method attempts to generate new keying material. Depending on the algorithm used either a single <CryptoKey> or a <CryptoKeyPair> is generated.】

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

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

  • 'ECDH'
  • 'ECDSA'
  • 'Ed25519'
  • 'Ed448'5
  • 'ML-DSA-44'[^现代算法]
  • 'ML-DSA-65'[^现代算法]
  • 'ML-DSA-87'[^现代算法]
  • 'ML-KEM-512'[^现代算法]
  • 'ML-KEM-768'[^现代算法]
  • 'ML-KEM-1024'[^现代算法]
  • 'RSA-OAEP'
  • 'RSA-PSS'
  • 'RSASSA-PKCS1-v1_5'
  • 'X25519'
  • 'X448'5

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

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

  • 'AES-CBC'
  • 'AES-CTR'
  • 'AES-GCM'
  • 'AES-KW'
  • 'AES-OCB'[^现代算法]
  • 'ChaCha20-Poly1305'4
  • 'HMAC'
  • 'KMAC128'4
  • 'KMAC256'4