Groups | Blog | Home
all groups > dotnet web services enhancements > may 2006 >

dotnet web services enhancements : Obtain Certificate Information


Taurus
5/17/2006 8:54:02 AM
Greetings.

I'm using at the moment WSE 2.0 SP3 and i made some web methods to get some
information from a database.

The current configuration is:

- 1 x509 certificate on the server and 1 on the client
- both the request and response is signed and encrypted using the
policycache.config file made with the wizard

Everything works fine. The traces files show that both the request and the
response are encrypted.

The problem is, i would like to get, inside the server web method, the
information inside the certificate received, like what is the issued name,
the issued by to use like a parameter to query the database.

Pablo Cibraro
5/17/2006 9:19:17 PM
You Taurus,

You should get a X509SecurityToken instance from the collection
RequestSoapContext.Current.Security.Tokens. That token contains all the
information related to the certificate.
For example,

X509SecurityToken st = null;

foreach(SecurityToken token in RequestSoapContext.Current.Security.Tokens)
{
if(token is X509SecurityToken)
st = token;

break;
}

I hope this can help you
Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax

[quoted text, click to view]

Taurus
5/18/2006 3:01:02 AM
Works like a charm.

Thanks and best regards Pablo.

[quoted text, click to view]
AddThis Social Bookmark Button