Security Certificate Store(CertOpenStrore)
-
I am programming a Socket enabled with SSL.I want to get certificate from a store provider.my certificate provider is a file.i downloaded the openssl and installed it.i used a command to generate certifcate request
openssl>req -newkey rsa:1024 -keyout server.key -nodes -days 365 -out server.crt
with this command a certificate request (server.crt) is generated.i opened the server.crt and pasted it contents in Advance option (certificate service) to get the certificate.i got a certificate named as"certnew.cer".i opened the certificate ,there was an option "copy to file".i opted for PKCS#7 Certificates(.P7B) and named it FileStore.A file was generated named as Filestore.p7b //this my code for certificate store#define ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING) HCERTSTORE m_hMyCertStore;//handle to certificate store m_hMyCertStore = CertOpenStore( CERT_STORE_PROV_FILENAME_A,// define the store provider type,here it is a //file on disk. ENCODING_TYPE,// encoding type for certificate & message NULL, // choose a default CSR. NULL, //default flag _T("FileStore.p7b")); //The name of an existing file
i want to know whether my procedure is right to get the certificate from store.because i m getting error when i want credentials for schannel -- modified at 1:14 Thursday 29th September, 2005