2

I am trying to use a provided sha384 ecdsa certificate in client authentication in a web request. Certificate in local store Certificate

I can also read out the cert from the local store without issues: 3 But as you can see in the screenshot the private and public key are not supported in those properties anymore due to ecdsa algorithm (see also: ms-link).

Instead in .Net there are methods provided to you to read out private and public key (GetECDsaPrivateKey, GetECDsaPublicKey).

If I try do a request using this cert:

var cert =  GetCertificateFromStoreByIssuerName("myCert");
var handler = new HttpClientHandler();
handler.ClientCertificateOptions = ClientCertificateOption.Manual;
handler.ClientCertificates.Add(cert);
var client = new HttpClient(handler);

var content = new StringContent("myContent");

var result = await client.PostAsync("https://my-cert-server.com", content );
var resp = await result.Content.ReadAsStringAsync();

I get a 403 back. (Using the previous sha1 rsa cert it worked flawlessly).

Anyone a clue, what I should do differently?

My assumption is that when SSL connection is tried to be estabished the properties "PrivateKey" or "PublicKey" are being used, but those don“t contain the keys anymore.

0 Answers0