web api interface
CryptoKey
Secure contextAvailable in workers
The CryptoKey interface of the Web Crypto API represents a cryptographic key obtained from one of the SubtleCrypto methods generateKey(), deriveKey(), importKey(), or unwrapKey().
For security reasons, the CryptoKey interface can only be used in a secure context.
Instance properties
-
typeRead only- : The type of key the object represents. It may take one of the following values:
"secret","private"or"public".
- : The type of key the object represents. It may take one of the following values:
-
extractableRead only- : A boolean value indicating whether or not the key may be extracted using
SubtleCrypto.exportKey()orSubtleCrypto.wrapKey().
- : A boolean value indicating whether or not the key may be extracted using
-
algorithmRead only- : An object describing the algorithm for which this key can be used and any associated extra parameters.
-
usagesRead only- : An
Arrayof strings, indicating what can be done with the key. Possible values for array elements are"encrypt","decrypt","sign","verify","deriveKey","deriveBits","wrapKey", and"unwrapKey".
- : An
Examples
The examples for SubtleCrypto methods often use CryptoKey objects. For example:
SubtleCrypto.generateKey()SubtleCrypto.deriveKey()SubtleCrypto.importKey()SubtleCrypto.exportKey()SubtleCrypto.wrapKey()SubtleCrypto.unwrapKey()SubtleCrypto.encrypt()SubtleCrypto.decrypt()SubtleCrypto.sign()SubtleCrypto.verify()
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.