CryptoSys PKI Toolkit Manual

X509_HashIssuerAndSN

Returns the message digest hash of the PKCS #7 issuerAndSerialNumber value of an X.509 certificate in hexadecimal format.

VB6/VBA Syntax

Public Declare Function X509_HashIssuerAndSN Lib "diCrPKI.dll" (ByVal strCertFile As String, ByVal strOutput As String, ByVal nOutChars As Long, ByVal nOptions As Long) As Long

nRet = X509_HashIssuerAndSN(strCertFile, strOutput, nOutChars, nOptions)

Parameters

strCertFile
[in] String with the filename of the X.509 certificate (or base64 representation).
strOutput
[out] String to receive the hash digest.
nOutChars
[in] Long specifying the maximum number of characters to be received.
nOptions
[in] Long Option flags. Select one of:
PKI_HASH_SHA1 (0) to use the SHA-1 algorithm (default)
PKI_HASH_MD5 to use the MD5 algorithm
PKI_HASH_MD2 to use the MD2 algorithm
PKI_HASH_SHA256) to use the SHA-256 algorithm
PKI_HASH_SHA384 to use the SHA-384 algorithm
PKI_HASH_SHA512 to use the SHA-512 algorithm
PKI_HASH_SHA224 to use the SHA-224 algorithm

C/C++ Syntax

long _stdcall X509_HashIssuerAndSN(const char *szCertFile, char *szOutput, long nOutChars, long flags);

Returns (VB6/C)

Long: Returns the number of characters set in strOutput. If nOutChars is zero it returns the maximum number of characters required. C/C++ users should allocate one extra for the terminating NUL character. If an error occurs, it returns a negative error code.

.NET Equivalent

X509.HashIssuerAndSN Method

Remarks

The certificate may be in binary BER format or base64 PEM format.

Example

    Dim nRet As Long
    Dim strCertName As String
    Dim strOutput As String * PKI_MAX_HASH_CHARS
     
    strCertName = "C:\Test\BobRSASignByCarl.cer"	' Set dir to suit
    nRet = X509_HashIssuerAndSN(strCertName, strOutput, Len(strOutput), 0)
    Debug.Print "X509_HashIssuerAndSN returns " & nRet & " for " & strCertName & ": " & Left(strOutput, nRet)

Should result in

X509_HashIssuerAndSN returns 40 for C:\Test\BobRSASignByCarl.cer: 
483538bca32adeb3134fe9f74d1ae74cc9ed2e9e

See Also

X509_CertIsValidNow X509_CertThumb

[Contents] [Index]

[HOME]   [NEXT: X509_KeyUsageFlags...]

Copyright © 2004-12 D.I. Management Services Pty Ltd. All rights reserved.