CertStoreOpen Function

W

Wilayat

Hello to all friends!

I am using an example program in MS Visual C++ taken from MSDN at
http://msdn.microsoft.com/en-us/library/aa382372(VS.85).aspx. I
created a certificate using

makecert -n "CN=Test" -sk Test -ss my Test.cer

This created a store 'my' and a Test.cer file. i see 'Test.cer' there
in ...\vc\bin folder. I could not find any store with the name 'my'.
now when i executed the code below (complete program is at the above
link),

Code:
   ......
 #define SIGNER_NAME L"Test"
   ......
 #define CERT_STORE_NAME  L"my"
   ......
if ( !( hCertStore = CertOpenStore(
       CERT_STORE_PROV_SYSTEM,
       0,
       NULL,
       CERT_SYSTEM_STORE_CURRENT_USER,
       CERT_STORE_NAME)))
    {
         MyHandleError(TEXT("The MY store could not be opened."))
         goto exit_SignMessage
    }

    // Get a pointer to the signer's certificate.
    // This certificate must have access to the signer's private key.
    if(pSignerCert = CertFindCertificateInStore(
       hCertStore,
       MY_ENCODING_TYPE,
       0,
       CERT_FIND_SUBJECT_STR,
       SIGNER_NAME,
       NULL))
    {
       _tprintf(TEXT("The signer's certificate was found.\n"))
    }
    else
    {
        MyHandleError( TEXT("Signer certificate not found."))
        goto exit_SignMessage
    }

it give error "Singer Certificate not found". Can any body help me
how to solve this problem? The 'my' certificate store, is not visible.
can I open the store in some editor etc to see the certificate? Or how
to create a store then?

regards,
wilayat
 

Similar threads

Back
Top Bottom