The CryptoKey.usages read-only property is an array of enumerated that indicates the purposes of the key.
Possible values are:
"encrypt", allowing the key to be used for encrypting messages."decrypt", allowing the key to be used for decrypting messages."sign", allowing the key to be used for signing messages."verify", allowing the key to be used for verifying the signature of messages."deriveKey", allowing the key to be used as a base key when deriving a new key."deriveBits", allowing the key to be used as a base key when deriving bits of data for use in cryptographic primitives."wrapKey", allowing the key to wrap a symmetric key for usage (transfer, storage) in unsecure environments."unwrapKey", allowing the key to unwrap a symmetric key for usage (transfer, storage) in unsecure environments.
Syntax
result =key.usages
Return value
resultis anArrayof enumerated values.
Specifications
| Specification | Status | Comment |
|---|---|---|
| Web Cryptography API The definition of 'CryptoKey.usages' in that specification. |
Recommendation | Initial definition. |
Browser compatibility
| Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|---|
| Basic support | 37 | (Yes) | 34 (34) | No support | ? | No support |
| Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|---|---|
| Basic support | (Yes) | 37 | (Yes) | 34.0 (34) | No support | ? | No support |
See also
CryptoandCrypto.subtle.CryptoKey, the interface it belongs to.