Help with assertion encryption ?
Brent Putman
putmanb at georgetown.edu
Wed May 21 15:30:08 EDT 2014
On 5/20/14 6:49 PM, Brent Putman wrote:
>
>
> byte[] iv = generateBytes(96/8);
> ////AlgorithmParameterSpec algParamSpec = new IvParameterSpec(iv);
> AlgorithmParameterSpec algParamSpec = new GCMParameterSpec(128, iv);
>
>
> I just tested that mechanism with BC on Java 7 and it works also.
Turns out this was not 100% working. With BC when I use
GCMParameterSpec it appears to work successfully to encrypt and decrypt
a plaintext blob. This is just Cipher usage, not Santuario/XMLCipher.
However, when I tried my full XMLCipher patch with Java 7 and BC and a
real XML encryption case, it fails because after encryption,
Cipher#getIV() returns null. XMLCipher uses this to concatenate the IV
to the encrypted bytes.
BC says in their release notes for 1.50 that they support GCMParameterSpec:
http://www.bouncycastle.org/releasenotes.html
> The JDK 1.5+ provider will now recognise and use GCMParameterSpec if
> it is run in a 1.7 JVM.
I'm not very familiar with BC's codebase, but I'll try and track this
down and at least see if the Cipher#getIV() issue is just a simple bug
that could be fixed.
Btw, I tested and I think we could solve the 1.7 requirement for
GCMParameterSpec using reflection in the Santuario patch: if you can
instantiate GCMParameterSpec use it (i.e Java 7+), otherwise just use
IvParameterSpec (Java 6). But I'm going to hold off on submitting that
until I figure out the BC issue.
Anyway, the executive summary at this point is that:
1) AES GCM doesn't work for XML Encryption on plain Java 8, unlike what
we previously thought
2) fixing it involves 1-2 libraries that are not ours
3) fixing it looks like it's going to be more complex than it ideally
would be
(Also: I was hoping RSA OAEP 1.1 was just going to work on Java 8...
guess I better start testing that too...)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20140521/85de6efe/attachment.html
More information about the dev
mailing list