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()
| 支持的密钥算法 | 加密 | 签名和消息认证码 | 密钥或位衍生 | 密钥封装 | 密钥封装 |
| --- | --- | --- | --- | --- | --- |
| '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 | | | ✔ | | |