Windows Dev Center

Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

CryptographicEngine.VerifySignature | verifySignature method

Verifies a message signature.

Syntax


var boolean = Windows.Security.Cryptography.Core.CryptographicEngine.verifySignature(key, data, signature);

Parameters

key

Type: CryptographicKey

Key used for verification. This must be the same key previously used to sign the message.

data

Type: IBuffer

Message to be verified.

signature

Type: IBuffer

Signature previously computed over the message to be verified.

Return value

Type: Boolean [JavaScript] | System.Boolean [.NET] | Platform::Boolean [C++]

true if the message is verified.

Remarks

To sign content, the sender typically creates a hash over the message, signs (encrypts) the hash, and then sends both the signature and the unencrypted message. The recipient uses the same key and algorithm to calculate a hash over the message, decrypts the signature, and compares the decrypted signature to the hash value. If they match, the recipient can be fairly certain that the message did, in fact, come from the sender and was not altered during transmission. For more information, see Hashes and Digital Signatures.

Examples


public void SampleVerifyHMAC(
    IBuffer buffMsg,
    CryptographicKey hmacKey,
    IBuffer buffHMAC)
{
    // The input key must be securely shared between the sender of the HMAC and 
    // the recipient. The recipient uses the CryptographicEngine.VerifySignature() 
    // method as follows to verify that the message has not been altered in transit.
    Boolean IsAuthenticated = CryptographicEngine.VerifySignature(hmacKey, buffMsg, buffHMAC);
    if (!IsAuthenticated)
    {
        throw new Exception("The message cannot be verified.");
    }
}


Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Security.Cryptography.Core
Windows::Security::Cryptography::Core [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.Security.Cryptography.Core
Windows::Security::Cryptography::Core [C++]

Metadata

Windows.winmd

See also

CryptographicEngine

 

 

Show:
© 2015 Microsoft