Collapse the table of content
Expand the table of content

verify method

Returns an object that can verify that the given signature or message authentication code (MAC) is valid for the given data using the specified algorithm and key object. If the signature or MAC is invalid, then either the data or the signature/MAC has been tampered with since the signature/MAC was generated.

Important  As of Microsoft Edge, this method returns a Promise object. See Web Cryptography API updates for more info.



var retVal = SubtleCrypto.verify(algorithm, key, signature, buffer);


algorithm [in]

Type: any

An object identifying the cryptographic algorithm that was used to generate the signature or MAC (along with any required algorithmic parameters).

key [in]

Type: Key

The key to be used for verifying the signature or MAC. For signatures, this is the public key corresponding to the private key that was used to create the signature. For MACs, this is the key that was used to create the MAC.

signature [in]

Type: ArrayBufferView

The signature or MAC.

buffer [in, optional]

Type: ArrayBufferView

The data over which the signature or MAC was purportedly computed.

Return value

Type: Promise

A Promise object that will verify data using the specified algorithm with the supplied key.

Note  IE11 returns a CryptoOperation. See Web Cryptography API updates for more info.


The verify method supports the following cryptographic algorithms:

  • RSAES-PKCS1-v1_5
  • HMAC

For a code example, see sign.

See also




© 2016 Microsoft