CRYPT_ECC_DSA_HashVerify Function

C

int CRYPT_ECC_DSA_HashVerify(
    CRYPT_ECC_CTX* ecc, 
    const unsigned char* sig, 
    unsigned int sigSz, 
    unsigned char* hash, 
    unsigned int hashSz, 
    int* status
);

Description

This function verifies that an ECC signature is valid.

Preconditions

The ECC context must have been initialized with a call to CRYPT_ECC_Initialize. The key used for the signature must have been imported or created prior to calling this function.

Parameters

Parameters Description
ecc Pointer to context which saves state between calls.
sig The signature to verify.
sigSz The length of the signature (octets).
hash The hash (message digest) that was signed.
hashSz The length of the hash (octets).
status Result of signature (1 == valid, 0 == invalid).

Returns

Remarks

None.

Example

CRYPT_ECC_CTX userA; 
int           ret;
byte          sig[100];
unsigned int  sigSz = (unsigned int)sizeof(sig);
unsigned int  usedA = 0;
int verifyStatus = 0;

ret = CRYPT_ECC_Initialize(&userA);
...
// Import or generate private key
...
ret = CRYPT_ECC_DSA_HashVerify(&userA, sig, sigSz, ourData, CRYPT_SHA_DIGEST_SIZE, &verifyStatus);