issuedTokenAuthentication\knownCerticates Validation Problem

Hi,

I am in the midst of porting over the Remote STS samples (from here) to the July CTP. I am faced with an issue that I totally have no idea how to solve.

My Service config behaviour config looks like this:

<serviceBehaviors>
<behavior name="serviceBehavior">
<serviceCredentials>
<serviceCertificate findValue="Fabrikam" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/>
<clientCertificate>
<authentication certificateValidationMode="None" revocationMode="NoCheck" />
</clientCertificate>
<issuedTokenAuthentication allowUntrustedRsaIssuers="true">
<knownCertificates>
<add findValue="Contoso" storeLocation="LocalMachine" storeName="TrustedPeople" x509FindType="FindBySubjectName" />
</knownCertificates>
</issuedTokenAuthentication>
</serviceCredentials>
<serviceDebug includeExceptionDetailInFaults="False" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors >

At my remote STS, I have code snippets that returns a signing token:

// This method determines the security token that contains the key material that
// the STS should sign the issued token with in order
// for the service the issued token is intended for to trust that token
private SecurityToken GetSigningToken()
{
// Set signingCert to null
SecurityToken signingToken = null;

// ... Open the LocalMachine store in My for read-only access
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadOnly);

// Find the "STS" cert ...
foreach (X509Certificate2 cert in store.Certificates)
if (cert.SubjectName.Name == "CN=Contoso")
{
// ... and set signingCert to that cert
signingToken = new X509SecurityToken(cert);
break;
}

// Don't forget to close the store
store.Close();

// return the token
return signingToken;
}

While this sample works fine with the previous CTPs, it is throwing a verification exception in the July CTP.
Exception: Message security verification failed.

The inner exception reveals this:
System.ServiceModel.Security.MessageSecurityException: Message security verification failed. &gt; System.IdentityModel.Tokens.SecurityTokenValidationException: The X.509 certificate CN=Contoso chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. A certificate chain processed, but terminated in a root certificate which is not trusted by the trust provider.
at System.IdentityModel.Selectors.X509CertificateChain.Build(X509Certificate2 certificate)

While I am sure the certs I use can be trusted right to the root CA, I am stumped by this exception OR rather how do I set the certificateValidationMode for this? I dont think I can set it in the <issuedTokenAuthentication> element itself ?

The only difference on the wire I see is that the Signatures are ENCRYPTED by default now on the wire to prevent any kind of guessing attacks.

I am stumped on this one. Can anyone here help on this ?


[3386 byte] By [Softwaremaker] at [2008-2-3]
# 1

Maybe the problem is in other part of the code because error message refers to "CN=IPKey" and I can't find such certificate anywhere in your shown code or markup.

Srdjan

srdjan.bozovic at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows CardSpace (InfoCard)...
# 2

That was my fault - a typo.

It has been corrected. Thats what I get for running multiple traces and windows all at the same time.

Anyone can offer any good pointers/tips/solutions/workarounds ?

Thanks.

Softwaremaker at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows CardSpace (InfoCard)...
# 3

Have you tried with HA certificates, ie. the certificates that were delivered with July CTP samples. Maybe CardSpace requires HA certificates to work?

Srdjan

srdjan.bozovic at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows CardSpace (InfoCard)...
# 4

Which certs are you talking about in specific ?

I dont think we can get HA certs yet, can we ?

Softwaremaker at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows CardSpace (InfoCard)...
# 5

I am reffering to certificates used in July CTP samples (http://cardspace.netfx3.com/files/folders/samples-july-ctp/entry4898.aspx). There is also a tutorial how to install them and set their ACL-s.

srdjan

P.S.

I am working on issuing test HA certificates with NonMicrosoft CA but no results yet :(

srdjan.bozovic at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows CardSpace (InfoCard)...
# 6

Looks like the certificates added into the issuedTokenAuthentication\knownCerticates have to be HA certificates with CRL endpoints.

Is there a way to change or disable the validation or revocation mode for these "known certificates" ?

Softwaremaker at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows CardSpace (InfoCard)...
# 7

The certificates do not have to be HA (now called EV, "Extended Validation").

If the CRL is not accessible, you will not be able to validate the certificate. This can be altered by either adding the certificate itself into the trusted people store, or turning off the certificate validation.

g


Garrett Serack | Program Manager |Federated Identity Team | Microsoft Corporation
blog:http://blogs.msdn.com/garretts

GarrettSerack-MSFT at 2007-8-30 > top of Msdn Tech,Software Development for Windows Vista,Windows CardSpace (InfoCard)...

Software Development for Windows Vista

Site Classified