x509certificate2

Client certificate is always null

大憨熊 提交于 2019-12-08 05:09:58
问题 I have a certificate installed under Personal as well as Trusted Root Certification Authorities Have tried using this bit of code to post to an endpoint: public void Post() { try { var clientCert = LoadFromStore("MyThumbprint"); var requestHandler = new WebRequestHandler(); requestHandler.ClientCertificates.Add(clientCert); var client = new HttpClient(requestHandler) { BaseAddress = new Uri("https://localhost:44430/") }; var response = client.GetAsync("api/test").Result; response

Revoked X509Certificate

给你一囗甜甜゛ 提交于 2019-12-08 04:32:57
问题 How can I programmatically get when X509Certificate is revoked? I can get information if certificate is revoked, but i need to get when is revoked, i think that CRL list have that info, but can someone tell me how to read that. 回答1: Revocation status is checked by (a) obtaining CRL lists and checking if the certificate is listed there, and (b) sending an OCSP request to the server to check the same. .NET doesn't let you do this. CryptoAPI might have some means for these operations, but the

“error:23076071:PKCS12 routines:PKCS12_parse:mac verify failure” when generating self signed certificate for Identity Server 4

时光毁灭记忆、已成空白 提交于 2019-12-08 03:15:28
We're developing a microservices app on Kubernetes. One of the microservices is IdentityServer instance. Initially, I want to test the solution locally on Docker to make sure it works. For this purpose, I want to copy the certificate to appsettings.json. Eventually this value will be replaced by a Kubernetes secret. In my startup class this is how I'm trying to load my certificate: services.AddIdentityServer() .AddSigningCredential(GetIdentityServerCertificate()) .AddConfigurationStore(... private X509Certificate2 GetIdentityServerCertificate() { var clientSecret = Configuration["Certificate"]

X509Certificate Implementation best practices

孤街醉人 提交于 2019-12-08 02:50:01
问题 Firstly, Thanks to all those patient techies trying to help unknown people. Secondly, I have a wcf service which should be consumed by only several clients (10) known to our company. This wcf service has the x509certificate "CN=ABCD". Now it expects to receive a certificate in turn from clients to consume this service. So here are the design questions Should I create one certificate "CN=ABCD" , then right click on it and export as pfx files and distribute them to Clients? Some say to validate

X509Certificate2 the server mode SSL must use a certificate with the associated private key

不羁的心 提交于 2019-12-07 17:23:23
问题 I use SslStream to build a web server. However, the code below throws an exception when AuthenticateAsServer. static X509Certificate cert; protected virtual Stream GetStream(TcpClient client) { var ss = new SslStream(client.GetStream(), false); if (cert == null) { cert = X509Certificate2.CreateFromCertFile("test.cer"); } ss.AuthenticateAsServer(cert, false, System.Security.Authentication.SslProtocols.Tls, true); return ss; } I've already used X509Certificate2 to load the cert file why it

How can I encrypt, decrypt and sign using .pfx certificate?

徘徊边缘 提交于 2019-12-07 17:00:52
问题 I have a .pfx certificate file on my computer. I want to to encrypt a message with its public key, and then decrypt it with the private. Also I want to sign another message with its private key, and then check the signature. And I need to get the information about the sertificate the message was signed with from that message. How can I do it using System.Security.Cryptography? 回答1: You can open the PFX in .NET, like the following: var path = <YOUR PFX FILE PATH>; var password = <YOUR PASSWORD

Revoked X509Certificate

孤人 提交于 2019-12-06 16:21:07
How can I programmatically get when X509Certificate is revoked? I can get information if certificate is revoked, but i need to get when is revoked, i think that CRL list have that info, but can someone tell me how to read that. Revocation status is checked by (a) obtaining CRL lists and checking if the certificate is listed there, and (b) sending an OCSP request to the server to check the same. .NET doesn't let you do this. CryptoAPI might have some means for these operations, but the easiest is to use third-party library for .NET. BouncyCastle claims to have some support for OCSP and CRLs,

Client certificate is always null

孤人 提交于 2019-12-06 15:51:35
I have a certificate installed under Personal as well as Trusted Root Certification Authorities Have tried using this bit of code to post to an endpoint: public void Post() { try { var clientCert = LoadFromStore("MyThumbprint"); var requestHandler = new WebRequestHandler(); requestHandler.ClientCertificates.Add(clientCert); var client = new HttpClient(requestHandler) { BaseAddress = new Uri("https://localhost:44430/") }; var response = client.GetAsync("api/test").Result; response.EnsureSuccessStatusCode(); string responseContent = response.Content.ReadAsStringAsync().Result; Console.WriteLine

x509 Certificate installation using VB.NET

孤者浪人 提交于 2019-12-06 15:01:34
I have an issue when installing x509 certificate in the system through vb.net. Installation itself is successful, but when I do install it through the code I do get one entry in Certificate Management window as displayed bellow: However when I install it manually using import function in Certificate Management window I do get two entries in the list for this certificate: The problem that I am facing is that when I use this certificate to perform certain tasks (passing some info to the third party service) it only works when it is manually imported (there are two entries in the certificate list

X509Certificate Implementation best practices

余生颓废 提交于 2019-12-06 13:02:09
Firstly, Thanks to all those patient techies trying to help unknown people. Secondly, I have a wcf service which should be consumed by only several clients (10) known to our company. This wcf service has the x509certificate "CN=ABCD". Now it expects to receive a certificate in turn from clients to consume this service. So here are the design questions Should I create one certificate "CN=ABCD" , then right click on it and export as pfx files and distribute them to Clients? Some say to validate in code and some say to validate in config which is better? How should I know which client is calling