M
Mfenetre
Hello all,
I'm trying to build a .Net client connecting to a Web service and I
want to use SSL with mutual authentication. The web service is designed
to require a client certificate.
I use .Net Framework v1.1.4322, IIS 6.0, Windows 2003 Srv and Visual
Studio.
So far I've been able to set SSL with just server authentication and I
can't succeed in writing a C# client using a client certificate.
I've a client certificate installed in the Personnal Store of the
Administrator and I'm trying to use it with this piece of code :
//opening the current user store
X509CertificateStore store =
X509CertificateStore.CurrentUserStore(X509CertificateStore.MyStore);
store.OpenRead();
//looking for the right certificate
X509CertificateCollection col=
(X509CertificateCollection)store.FindCertificateByKeyIdentifier(Convert.FromBase64String("dUvy6QHZTkuzfwQFqh2ZvYE6gdE="));
X509Certificate cert =null;
cert = col[0];
//my proxy to the web service
CreditCardWebServiceMutAuth.CreditCardWebServiceMutAuth ws = new
CreditCardWebServiceMutAuth.CreditCardWebServiceMutAuth();
//adding the client certificate
ws.ClientCertificates.Add(cert);
[some personal code]
//getting the result
string resultString =
ws.analyzeCreditCard(creditCardNumberString,typeString,ownerString,expirationDateString);
And here it fails, I get a 403 error : Forbidden. It seems that the
client certificate is not sent/used by the .Net client.
What I am sure :
# the certificate is the current user store, Personal Store (I've tried
with Local Machine store, but no success)
# I've the private key and I've granted access to this private key to
anyone
# I can access to my web service as long as I don't require a client
certificate
Can you help me ? Do you have any clue ?
Thanks in advance,
Regards,
Alexis.
I'm trying to build a .Net client connecting to a Web service and I
want to use SSL with mutual authentication. The web service is designed
to require a client certificate.
I use .Net Framework v1.1.4322, IIS 6.0, Windows 2003 Srv and Visual
Studio.
So far I've been able to set SSL with just server authentication and I
can't succeed in writing a C# client using a client certificate.
I've a client certificate installed in the Personnal Store of the
Administrator and I'm trying to use it with this piece of code :
//opening the current user store
X509CertificateStore store =
X509CertificateStore.CurrentUserStore(X509CertificateStore.MyStore);
store.OpenRead();
//looking for the right certificate
X509CertificateCollection col=
(X509CertificateCollection)store.FindCertificateByKeyIdentifier(Convert.FromBase64String("dUvy6QHZTkuzfwQFqh2ZvYE6gdE="));
X509Certificate cert =null;
cert = col[0];
//my proxy to the web service
CreditCardWebServiceMutAuth.CreditCardWebServiceMutAuth ws = new
CreditCardWebServiceMutAuth.CreditCardWebServiceMutAuth();
//adding the client certificate
ws.ClientCertificates.Add(cert);
[some personal code]
//getting the result
string resultString =
ws.analyzeCreditCard(creditCardNumberString,typeString,ownerString,expirationDateString);
And here it fails, I get a 403 error : Forbidden. It seems that the
client certificate is not sent/used by the .Net client.
What I am sure :
# the certificate is the current user store, Personal Store (I've tried
with Local Machine store, but no success)
# I've the private key and I've granted access to this private key to
anyone
# I can access to my web service as long as I don't require a client
certificate
Can you help me ? Do you have any clue ?
Thanks in advance,
Regards,
Alexis.