From msdn: Transact-SQL Reference
Process is simple. First you need to add a HWND to your WPF applications in UI to host Windows Form controls there. Actually you must derive a class from HwndHost base class to be able to do this but thankfully Microsoft has done the main job and has added a default implementation that is suitable for many common needs and it’s WindowsFormsHost.
Getting CardSpace Tokens Programmatically
The wrapper allows you to basically pass in the required details (issuer and target URI, the target identity as well as required/optional claims) and get back the encrypted XML token.
This code snippet shows how to use the wrapper to get a token for a self issued card:
IdentitySelector selector = new IdentitySelector(); selector.IssuerUri =
new Uri("http://schemas.xmlsoap.org/ws/2005/05/identity/issuer/self"); selector.TargetUri = new Uri("http://relyingParty"); selector.SetTargetCertificate("RelyingParty", X509FindType.FindBySubjectName, StoreLocation.CurrentUser, StoreName.AddressBook); selector.RequiredClaims.Add(ClaimTypes.GivenName); selector.RequiredClaims.Add(ClaimTypes.Surname); selector.RequiredClaims.Add(ClaimTypes.Email); string tokenString = selector.GetTokenString();
From this point on it is up to you to use this token in whatever way you want.
It is as easy a shipping a string to your relying party.
And his book: