<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<div class="moz-cite-prefix">On 5/20/14 6:49 PM, Brent Putman wrote:<br>
</div>
<blockquote cite="mid:537BDBEC.60505@georgetown.edu" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<br>
<br>
<tt>byte[] iv = generateBytes(96/8);</tt><tt><br>
</tt><tt>////AlgorithmParameterSpec algParamSpec = new
IvParameterSpec(iv);</tt><tt><br>
</tt><tt>AlgorithmParameterSpec algParamSpec = new
GCMParameterSpec(128, iv);</tt><br>
<br>
<br>
I just tested that mechanism with BC on Java 7 and it works also.
</blockquote>
<br>
<br>
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.<br>
<br>
BC says in their release notes for 1.50 that they support
GCMParameterSpec:<br>
<br>
<a class="moz-txt-link-freetext" href="http://www.bouncycastle.org/releasenotes.html">http://www.bouncycastle.org/releasenotes.html</a><br>
<br>
<blockquote type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
The JDK 1.5+ provider will now recognise and use GCMParameterSpec
if it is run in a 1.7 JVM.</blockquote>
<br>
<br>
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.<br>
<br>
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.<br>
<br>
<br>
Anyway, the executive summary at this point is that:<br>
1) AES GCM doesn't work for XML Encryption on plain Java 8, unlike
what we previously thought<br>
2) fixing it involves 1-2 libraries that are not ours<br>
3) fixing it looks like it's going to be more complex than it
ideally would be<br>
<br>
<br>
(Also: I was hoping RSA OAEP 1.1 was just going to work on Java 8...
guess I better start testing that too...)<br>
<br>
<br>
<br>
</body>
</html>