SSL connection error while accessing the certificates from console application.

Copper Contributor

Hi,
This is tharun_atturu, I am trying to use the ACM certificates by importing them from the .pfx file. I get the desired result when the application is run with system privileges but when I try the console application with admin privileges I am getting the SSL connection error.

Code:

 

 

                     X509Certificate2Collection collection = new X509Certificate2Collection();
                     collection.Import(certPath, CertFilePassword, X509KeyStorageFlags.MachineKeySet | 
                                                  X509KeyStorageFlags.PersistKeySet);
                     X509Store RootStore = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
                     X509Store CertificateAuthorityStore = new X509Store(StoreName.CertificateAuthority, 
                                                                                                            StoreLocation.LocalMachine);
                     X509Store ClientCertStore = new X509Store("ClientAuthIssuer", StoreLocation.LocalMachine);
                     RootStore.Open(OpenFlags.ReadWrite);
                     RootStore.Add(collection[0]);
                     CertificateAuthorityStore.Open(OpenFlags.ReadWrite);
                     CertificateAuthorityStore.Add(collection[1]);
                     ClientCertStore.Open(OpenFlags.ReadWrite);
                     ClientCertStore.Add(collection[2]);
                     RootStore.Close();
                     CertificateAuthorityStore.Close();
                     ClientCertStore.Close();

 

 

 

I am trying to access the cert from CPP using "Curl" to make an API call.
and I am getting this
ERROR:

  • schannel: AcquireCredentialsHandle failed: SEC_E_UNKNOWN_CREDENTIALS (0x8009030D) - The credentials supplied to the package were not recognized

  • Closing connection 0

  • schannel: shutting down SSL/TLS connection with api*.com port 443
    curl_easy_perform() failed: SSL connect error

Thank You.

@ryanchil

 

 

0 Replies