You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to reach an OData endpoint on port 443 that uses a client-certificate to authenticate, a self-signed client certificate.
That fails with this message: Cannot access < endpoint >. Exception message: 'The remote server returned an error: (401) Unauthorized'
I guess this is not supported? There is no way to specify the thumbprint which would allow you to find the certificate from the local store and add it to the request?
Is this a feature I can help develop?
Fetching a certificate form the store is done like this:
`
public static X509Certificate2 GetCertificate(string thumbprint)
{
thumbprint = Regex.Replace(thumbprint, @"[^\da-zA-z]", string.Empty).ToUpper();
var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
try
{
store.Open(OpenFlags.ReadOnly);
var certCollection = store.Certificates;
var signingCert = certCollection.Find(X509FindType.FindByThumbprint, thumbprint, false);
if (signingCert.Count == 0)
{
throw new FileNotFoundException($"Certificate with thumbprint: '{thumbprint}' not found in local machine cert store.");
}
return signingCert[0];
}
finally
{
store.Close();
}
}
`
But the XmlUrlResolver does not seem to support client certificates.
Although it seems to have a underlying WebRequest class, so in theory one should be able to call mywebRequest.ClientCertificates.Add(myClientCertificate).
Please advise
The text was updated successfully, but these errors were encountered:
I want to reach an OData endpoint on port 443 that uses a client-certificate to authenticate, a self-signed client certificate.
That fails with this message: Cannot access < endpoint >. Exception message: 'The remote server returned an error: (401) Unauthorized'
I guess this is not supported? There is no way to specify the thumbprint which would allow you to find the certificate from the local store and add it to the request?
Is this a feature I can help develop?
Fetching a certificate form the store is done like this:
`
public static X509Certificate2 GetCertificate(string thumbprint)
{
}
`
But the XmlUrlResolver does not seem to support client certificates.
Although it seems to have a underlying WebRequest class, so in theory one should be able to call mywebRequest.ClientCertificates.Add(myClientCertificate).
Please advise
The text was updated successfully, but these errors were encountered: