subtle.importKey(format, keyData, algorithm, extractable, keyUsages)


此方法尝试将提供的 keyData 解释为给定的 format,使用提供的 algorithmextractablekeyUsages 参数创建一个 <CryptoKey> 实例。如果导入成功,返回的 Promise 将会解析为键材料的 <CryptoKey> 表示。

【This method attempts to interpret the provided keyData as the given format to create a <CryptoKey> instance using the provided algorithm, extractable, and keyUsages arguments. If the import is successful, the returned promise will be resolved with a <CryptoKey> representation of the key material.】

如果导入 KDF 算法的密钥,extractable 必须为 false

【If importing KDF algorithm keys, extractable must be false.】

目前支持的算法包括:

【The algorithms currently supported include:】

Supported Key Algorithm'spki''pkcs8''jwk''raw''raw-secret''raw-public''raw-seed'
'AES-CBC'
'AES-CTR'
'AES-GCM'
'AES-KW'
'AES-OCB'4
'Argon2d'4
'Argon2i'4
'Argon2id'4
'ChaCha20-Poly1305'4
'ECDH'
'ECDSA'
'Ed25519'
'Ed448'5
'HDKF'
'HMAC'
'KMAC128'4
'KMAC256'4
'ML-DSA-44'4
'ML-DSA-65'4
'ML-DSA-87'4
'ML-KEM-512'4
'ML-KEM-768'4
'ML-KEM-1024'4
'PBKDF2'
'RSA-OAEP'
'RSA-PSS'
'RSASSA-PKCS1-v1_5'
'X25519'
'X448'5