CryptoKey
The CryptoKey
interface of the Web Crypto API represents a cryptographic key
obtained from one of the SubtleCrypto methods
generateKey() or
importKey().
Accessors
algorithm
Get Signature
get algorithm():
RsaHashedKeyGenParams
|EcKeyGenParams
|HmacKeyGenParams
|AesKeyGenParams
An object describing the algorithm for which this key can be used and any associated extra parameters. The object returned depends of the algorithm used to generate the key.
Returns
RsaHashedKeyGenParams
| EcKeyGenParams
| HmacKeyGenParams
| AesKeyGenParams
An object matching:
- AesKeyGenParams if the algorithm is any of the AES variants.
- RsaHashedKeyGenParams if the algorithm is any of the RSA variants.
- EcKeyGenParams if the algorithm is any of the EC variants.
- HmacKeyGenParams if the algorithm is HMAC.
extractable
Get Signature
get extractable():
boolean
A boolean value indicating whether or not the key may be extracted using SubtleCrypto.exportKey().
Returns
boolean
type
Get Signature
get type():
string
The type of key the object represents. It may take one of the following values: "secret", "private" or "public".
Returns
string
usages
Get Signature
get usages():
string
[]
An Array of strings, indicating what can be done with the key. Possible values for array elements are "encrypt", "decrypt", "sign", "verify", "deriveKey", "deriveBits", "wrapKey", and "unwrapKey".
Returns
string
[]
Last updated: Sep 30, 2025