So if you have the SKI, and it's in MD5 format, you can use
CertFindCertificateInStore and specify CERT_FIND_PUBKEY_MD5_HASH for the
dwFindType parameter. However, if the SKI is in any other format - such as
SHA1 - then you need to pretty much enumerate every certificate in the
store, get the SHA1 hash of the certificate's public key and compare it with
the SKI in question. I think you may be able to use CERT_FIND_KEY_IDENTIFIER
with CertFindCertificateInStore instead of the above method, but I haven't
tried it.
However, note that certificate authorities may use some other algorithm to
figure out the SKI. They could use any other algorithm or even include only
a part of a hash instead of the full hash. The only real requirement is that
the SKI matches the corresponding field in the AKI of certificates issued by
that certificate with the specific SKI.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Petar Popara" <my....@mail.net> wrote in message
news:eDU$wCo6EH...@TK2MSFTNGP10.phx.gbl...
Thanky you.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
"Petar Popara" <my....@mail.net> wrote in message
news:uqD3c2e7...@TK2MSFTNGP09.phx.gbl...
DWORD cbNameDecoded = 0;
BYTE* pbNameDecoded = 0;
if (!CryptDecodeObject(MY_ENCODING_TYPE,
szOID_SUBJECT_KEY_IDENTIFIER,
(BYTE*)pCert->pCertInfo->rgExtension,
pCert->pCertInfo->cExtension,
0,
NULL,
&cbNameDecoded))
{
//error
}
if (cbNameDecoded < 1)
{
//error
}
pbNameDecoded = new BYTE[cbNameDecoded];
if (!CryptDecodeObject(MY_ENCODING_TYPE,
szOID_SUBJECT_KEY_IDENTIFIER,
(BYTE*)pCert->pCertInfo->rgExtension,
pCert->pCertInfo->cExtension,
0,
pbNameDecoded,
&cbNameDecoded))
{
//error
}