x509certificate

Can't connect to HTTPS using X509 client certificate

穿精又带淫゛_ 提交于 2019-12-10 19:53:13
问题 I'm new to cryptography and I'm a bit stuck: I'm trying to connect (from my development environment) to a web service using HTTPS. The web service requires a client certificate - which I think I've installed correctly. They have supplied me with a .PFX file. In Windows 7, I double clicked the file to install it into my Current User - Personal certificate store. I then exported a X509 Base-64 encoded .cer file from the certificate entry in the store. It didn't have a private key associate with

X509 store can not find certificate by SerialNumber

為{幸葍}努か 提交于 2019-12-10 18:25:07
问题 I need to get a X509 Certificate by Serial Number, I have the serial number and I am looping through them and i see the serial number in the collection I need but it is never found. Here is my debug code just ot make sure I am seeing the proper serial numbers: X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine); store.Open(OpenFlags.ReadOnly); foreach (X509Certificate2 cert in store.Certificates) { System.Web.HttpContext.Current.Response.Write (cert.SerialNumber + "=" +

How to load a certificate with private key from PEM files in .NET standard

被刻印的时光 ゝ 提交于 2019-12-10 18:19:51
问题 I'm trying to load an X509Certificate2 from PEM files in a .NET standard library. I created a self-signed certificate using openssl like so: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -nodes -subj /CN=localhost -days 365 I loaded the resulting PEM files into embedded string resources within the project and am trying to load them with the following code: private X509Certificate2 GetCertificate() { try { byte[] pubPem = System.Text.Encoding.UTF8.GetBytes(Properties

X509Certificate2 p12 is store required?

无人久伴 提交于 2019-12-10 17:53:54
问题 Question when running the following code: X509Certificate2 cert = new X509Certificate2(@"C:\file.p12", "password", X509KeyStorageFlags.Exportable); RSACryptoServiceProvider crypt = (RSACryptoServiceProvider)cert.PrivateKey; I get the following error: Keyset does not exist . I have not added the certificate to a store, is this required to be able to access the private key? 回答1: Add the X509KeyStorageFlags.PersistKeySet option to the last argument of the X509Certificate2 constructor. Otherwise,

Automated downloading of X509 certificate chain from remote host

 ̄綄美尐妖づ 提交于 2019-12-10 17:22:56
问题 I am building some .net code that will run unattended on a scheduled basis on one of our servers. Part of its execution requires that it execute a Java executable which talks to some web resources and services over SSL. Java will absolutely throw a fit if it's doing something over SSL and it doesn't have every single certificate in the remote certificate's chain. So in .NET I need to be able to specify an https:// resource and need it to download the entire remote chain locally. Why do I want

How do I deploy a certificate to the Trusted People store in Azure?

我们两清 提交于 2019-12-10 16:57:51
问题 How can I get a public key certificate deployed to my Worker Role's Trusted People store? I'm using PeerTrust for WCF (self-hosted TCP services in Azure): var creds = new ServiceCredentials(); creds.ClientCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.PeerTrust; I know how to reference the certificate both in my .csdef and in code. However, I don't know how to take a .cer file (with no private key) and actually get it into Azure so it can use it for

Is it safe to test the X509Certificate.Thumbprint property when you know an invalid certificate is safe?

♀尐吖头ヾ 提交于 2019-12-10 15:50:03
问题 I'm attempting to send emails programmatically using SmtpClient.Send . I am currently getting an AuthenticationException when attempting to send the email. This is because of the certificate validation procedure failing. I know that the certificate is the correct one, but I also understand that it's not secure to trust all certificates much like the suggestions of doing this: ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => { return

How to make priv key in certificate not exportable C#

牧云@^-^@ 提交于 2019-12-10 12:46:46
问题 So below you'll find my code that creates a self signed certificate with the private key in there. It's stored in the user store. Now when I use the mmc tool I can just export the private key from the certificate? I thought that was a flag you had to explicitly add when you create the cert? So what I wanna know is, how do I change this code so that the private key is no longer exportable through mmc. Code: public static X509Certificate2 GenerateSelfSignedCertificateNoCA(string subjectName,

retrieving X509 certificates from AD Server

若如初见. 提交于 2019-12-10 12:17:42
问题 Is there any way we can fetch X509 Public Cetrificates using c# from AD Server for Encrypting an Email. Right now I am using the local Store for Picking up the Certificates and Encrypting an Mail. static public X509Certificate2 GetRecipientCertPublic(string recipientName) { X509Store storeAddressBook = new X509Store(StoreName.AddressBook, StoreLocation.CurrentUser); storeAddressBook.Open(OpenFlags.ReadOnly); X509Certificate2Collection certColl = storeAddressBook.Certificates.Find(X509FindType

HttpListener server returns an error: (503) Service Unavailable

血红的双手。 提交于 2019-12-10 11:54:09
问题 I am trying to create a http listener that uses x509 certificates for client/server authentication. My server code is as follows. _listener = new HttpListener(); _listener.Prefixes.Add("https://localhost:8006/"); _listener.Start(); HttpListenerContext context = _listener.GetContext(); My client code is as follows string url = "https://localhost:8006/"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); var store = new X509Store(StoreName.TrustedPeople, StoreLocation.LocalMachine