CertCompareIntegerBlob

The CertCompareIntegerBlob function compares two integer blobs to determine whether they are identical. Before doing the comparison, leading bytes with a value of 0x00 are removed from a positive number (by positive, it is meant that the most significant bit in the next nonzero byte is not set). Leading bytes with a value of 0xFF are removed from a negative number (by negative, it is meant that the most significant bit in the next non 0xFF byte is set). This produces the unique representation of that integer. For instance:

FFFFFFAB reduces to AB (shown in below example)
FF23 reduces to FF23
007F reduces to 7F
00000080 reduces to 0080

Multiple byte integers are treated as Little Endian. The least significant byte is pbData(0). The most significant byte is pbData(cbData - 1).

#include <wincrypt.h>
BOOL WINAPI CertCompareIntegerBlob(
  PCRYPT_INTEGER_BLOB pInt1    // in
  PCRYPT_INTEGER_BLOB pInt2    // in
);
 

Parameters

pInt1
A pointer to the first integer blob in the comparison.
pInt2
A pointer to the second integer blob in the comparison.

Return Values

Returns TRUE if the unique representation of the integer blobs are identical.

Example

// EXAMPLE CODE FOR USING CertCompareIntegerBlob() to 
// compare two integer blobs to determine whether they are identical.

// Assume that the application has a pointer to both integer blobs to 
// compare (pInt1, pInt2).

// Set up the variables.
BOOL                 Return;
PCRYPT_INTEGER_BLOB  pInt1, pInt2; 

// Initialize the blobs.
BYTE blob1data[4] = {0xFF, 0xFF, 0xFF, 0xAB};
BYTE blob2data[1] = {0xAB};
pInt1->pbData = (BYTE*)&blob1data;
pInt1->cbData = sizeof(blob1data);
pInt2->pbData = (BYTE*)&blob2data;
pInt2->cbData = sizeof(blob2data);

Return = CertCompareIntegerBlob(
            pInt1, pInt2);

if (Return == TRUE) {
    // For this example the integer blobs are identical, 
    
    // However, note that FALSE would have been returned if
    // BYTE blob2data[2] = {0x00, 0xAB}; had been used.
}
 

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later. Available also in IE 3.02 and later.
  Windows: Requires Windows 98 (or Windows 95 with IE 3.02 or later).
  Windows CE: Unsupported.
  Header: Declared in wincrypt.h.
  Import Library: Use crypt32.lib.