SubtleCrypto.unwrapKey() method returns a
Promise of a
CryptoKey corresponding to the wrapped key given in parameter.
var result = crypto
.unwrapKey(format, wrappedKey, unwrappingKey, unwrapAlgo, unwrappedKeyAlgo, extractable, keyUsages);
format is an enumerated value describing the data format of the key to unwrapped. It can be one of the following:
wrappedKey is a
ArrayBuffer or a ... containing the wrapped key in the given format.
unwrappingKey is the
CryptoKey to use to unwrap.
unwrapAlgo is the
DOMString} representing the algorithm used to perform the unwrapping. It is one of the following:
unwrappedKeyAlgo is the
DOMString} representing the algorithm of the wrapped key.
extractable is a
Boolean indicating if the key can be extracted from the
CryptoKey object at a later stage.
keyUsages is an
Array indicating what can be done with the unwrapped key. Possible values of the array 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.
The promise is rejected when one of the following exceptions is encountered:
InvalidAccessError when the unwrapping key is not a key for the requested unwrap algorithm or if the
CryptoKey.usages value of that key doesn't contain
NotSupported when trying to use an algorithm that is either unknown or isn't suitable for encryption or wrapping.
keyUsages is empty but the unwrapped key is of type
TypeError when trying to use an invalid format.
||Chrome for Android
||Firefox Mobile (Gecko)
Document Tags and Contributors
Last updated by: