The SubtleCrypto.verify()
method returns a Promise
of a Boolean
value indicating if the signature given as parameter matches the text, algorithm and key also given as parameters.
Syntax
var result = crypto.subtle.verify(algo, key, signature, text2verify)
;
Parameters
signature
is aArrayBuffer
or anArrayBufferView
containing the signature to verify.text2verify
is aArrayBuffer
or anArrayBufferView
containing the data whose signature as to be verified.key
is aCryptoKey
containing the key to be used to verify the signature. It is the secret key for a symmetric algorithm and the public key for an asymmetric algorithm.algo
is aDOMString
defining the signature function to use. Supported values are:HMAC
,RSASSA-PKCS1-v1_5
, andECDSA
.
Return value
result
is aPromise
that returns aBoolean
indicating if the signature has been a success on success.
Exceptions
The promise is rejected when the following exception is encountered:
InvalidAccessError
when the encryption key is not a key for the requested verifying algorithm or when trying to use an algorithm that is either unknown or isn't suitable for a verify operation.
Specifications
Specification | Status | Comment |
---|---|---|
Web Cryptography API The definition of 'SubtleCrypto.verify()' in that specification. |
Recommendation | Initial definition. |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 37 | 12 | 34 | 11 | 24 | 8 |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | Opera Android | iOS Safari | Samsung Internet |
---|---|---|---|---|---|---|---|
Basic support | 53 | 53 | ? | 34 | 37 | ? | 6.0 |
See also
Crypto
andCrypto.subtle
.SubtleCrypto
, the interface it belongs to.