Skip to Content.
Sympa Menu

mace-opensaml-users - Re: Re: Re: Re: Re: [OpenSAML] Problem reading SAML response

Subject: OpenSAML user discussion

List archive

Re: Re: Re: Re: Re: [OpenSAML] Problem reading SAML response


Chronological Thread 
  • From: <>
  • To: ,
  • Subject: Re: Re: Re: Re: Re: [OpenSAML] Problem reading SAML response
  • Date: Sat, 31 Jul 2010 01:02:30 -0400 (EDT)

I was able to resolve this myself. Thought of posting there solution as it can
benefit other new SAML users.

BasicCredential credential = new BasicCredential();
credential.setPrivateKey(privateKey);
KeyInfoCredentialResolver keyResolver = new
StaticKeyInfoCredentialResolver(credential);
EncryptedKey key =
encryptedAssertion.getEncryptedData().getKeyInfo().getEncryptedKeys().get(0);
Decrypter decrypter = new Decrypter(null, keyResolver, null);
SecretKey dkey = (SecretKey) decrypter.decryptKey(
key,
encryptedAssertion.getEncryptedData().getEncryptionMethod().getAlgorithm());
Credential shared = SecurityHelper.getSimpleCredential(dkey);
decrypter = new Decrypter(new StaticKeyInfoCredentialResolver(shared), null,
null);
Assertion assertion = decrypter.decrypt(encryptedAssertion);

Above code fully works.

I happen to stumble upon Bret's explanation in one of the threads that helped
me a lot.
http://groups.google.com/group/opensaml-users/browse_thread/thread/098452dd935
9663b

Now the only question I am left with is: Does this code handle all kinds of
SAMLResponses or is there anything I need to do to make it work for both
symmetric and assymmetric encryptions. I see that I might have to use
ChainEncryptedKeyResolver. Can anyone throw some light on it please?



Archive powered by MHonArc 2.6.16.

Top of Page