cryptoKey.usages
- 类型: <string[]>
一个字符串数组,用于标识该密钥可以使用的操作。
【An array of strings identifying the operations for which the key may be used.】
可能的用法是:
【The possible usages are:】
'encrypt'- 启用使用subtle.encrypt()的密钥'decrypt'- 启用使用subtle.decrypt()的密钥'sign'- 启用与subtle.sign()一起使用该密钥'verify'- 启用与subtle.verify()一起使用该密钥'deriveKey'- 启用将密钥用于subtle.deriveKey()'deriveBits'- 允许将密钥用于subtle.deriveBits()'encapsulateBits'- 允许使用该密钥与subtle.encapsulateBits()'decapsulateBits'- 允许使用该密钥与subtle.decapsulateBits()'encapsulateKey'- 允许使用该密钥与subtle.encapsulateKey()'decapsulateKey'- 允许使用该密钥与subtle.decapsulateKey()'wrapKey'- 启用使用subtle.wrapKey()的密钥'unwrapKey'- 启用使用subtle.unwrapKey()的密钥
有效的密钥用途取决于密钥算法(由 cryptokey.algorithm.name 标识)。
【Valid key usages depend on the key algorithm (identified by
cryptokey.algorithm.name).】
列图例:
- 加密:
subtle.encrypt()/subtle.decrypt() - 签名和 MAC:
subtle.sign()/subtle.verify() - 密钥或比特生成:
subtle.deriveBits()/subtle.deriveKey() - 密钥封装:
subtle.wrapKey()/subtle.unwrapKey() - 密钥封装:
subtle.encapsulateBits()/subtle.decapsulateBits()/subtle.encapsulateKey()/subtle.decapsulateKey()
| Supported Key Algorithm | Encryption | Signatures and MAC | Key or Bits Derivation | Key Wrapping | Key Encapsulation |
|---|---|---|---|---|---|
'AES-CBC' | ✔ | ✔ | |||
'AES-CTR' | ✔ | ✔ | |||
'AES-GCM' | ✔ | ✔ | |||
'AES-KW' | ✔ | ||||
'AES-OCB' | ✔ | ✔ | |||
'Argon2d' | ✔ | ||||
'Argon2i' | ✔ | ||||
'Argon2id' | ✔ | ||||
'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 | ✔ |