Hi dear developers can any one help me ?
I have a link like this:
ldap://annuaire.xxx.fr/cn=amo_pj.test@test.xx.fr,ou=AC-FACTURATION,ou=AC-SV-VITALE-2034,o=sv-vitale,c=fr?userCertificate;binary
I can paste this link on any navigator, get the certificate from the server, save it to disk and then install it in localmachine store.
But I would like to do it by program (either using c++ or c#)
What I have tried:
1) I tried this in c#
public static void InstallCertificate()
{
string address = @"ldap://annuaire.xxx.fr/cn=amo_pj.test@test.xx.fr,ou=AC-FACTURATION,ou=AC-SV-VITALE-2034,o=sv-vitale,c=fr?userCertificate;binary";
ICertRequest3 objRequest = new CCertRequest();
string rootCert = objRequest.GetCACertificate(0, address, 0);
byte[] buffer = Encoding.UTF8.GetBytes(rootCert);
// installing
var store = new X509Store("Root", StoreLocation.LocalMachine);
store.Open(OpenFlags.OpenExistingOnly | OpenFlags.ReadWrite);
var root = new X509Certificate2(buffer);
store.Add(root);
}
Error com:
CCertRequest::GetCACertificate: Le serveur RPC n’est pas disponible. 0x800706ba (WIN32: 1722)
2) I tried this one using openssl
OpenSSL> s_client -connect ldap://annuaire.xxx.fr:636 -showcerts
getservbyname failure for //annuaire.xxx.fr:636
OpenSSL> s_client -connect annuaire.xxx.fr:636 -showcerts
connect: No such file or directory
connect:errno=0
error in s_client