tharun_atturu
tharun_atturu

Reputation: 21

Schannel: AcquireCredentialsHandle failed: SEC_E_UNKNOWN_CREDENTIALS, SSL connection error while accessing the certificates from console application

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.

    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();

using libcurl to make an api call from cpp console application.

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.

Upvotes: 2

Views: 821

Answers (0)

Related Questions