Skip to Content.
Sympa Menu

mace-opensaml-users - Re: [OpenSAML] Encrypt/Decrypt assertion

Subject: OpenSAML user discussion

List archive

Re: [OpenSAML] Encrypt/Decrypt assertion


Chronological Thread 
  • From: Brent Putman <>
  • To:
  • Subject: Re: [OpenSAML] Encrypt/Decrypt assertion
  • Date: Mon, 15 Dec 2008 01:55:41 -0500




wrote:
> Hi,
>
> I'm new to opensaml, and I was able to solve most everything, but now I
> cannot encrypt an assertion and later decrypt it. The decrypter keeps
> telling me "Data encryption key may not be null".
>
>
>
Yeah, that means it can't successfully resolve the data decryption key,
and since you're using an encrypted key transported via an EncryptedKey,
ultimately it means it can't decrypt the EncryptedKey.


> BasicX509Credential credential = new BasicX509Credential();
> credential.setEntityCertificate(certificate);
>
> KeyInfoCredentialResolver keyResolver = new
> StaticKeyInfoCredentialResolver(credential);
>
> InlineEncryptedKeyResolver encryptionKeyResolver = new
> InlineEncryptedKeyResolver();
>
> Decrypter decrypter = new Decrypter(null, keyResolver,
> encryptionKeyResolver);
>
>
>


Remember that you decrypt with the recipient's private key. So you need
to also set the PrivateKey object on the Credential above with which you
are going to encrypt (the one that gets resolved and used by the Decrypter)


Offhand, everything else looks right, as far as I can tell.

--Brent





Archive powered by MHonArc 2.6.16.

Top of Page