teiid SVN: r4639 - in branches/7.7.x: common-core/src/main/java/org/teiid/core/crypto and 1 other directory.
by teiid-commits@lists.jboss.org
Author: jolee
Date: 2014-05-09 09:44:17 -0400 (Fri, 09 May 2014)
New Revision: 4639
Modified:
branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
branches/7.7.x/common-core/src/main/java/org/teiid/core/crypto/DhKeyGenerator.java
Log:
BZ1054940 - Roll up patch EDS_5.3.1_1_2014 + TEIID-2945 + TEIID-2952 addressing different vm handling of dh secret
Modified: branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html
===================================================================
--- branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html 2014-05-01 15:58:50 UTC (rev 4638)
+++ branches/7.7.x/build/kits/jboss-container/teiid-releasenotes.html 2014-05-09 13:44:17 UTC (rev 4639)
@@ -258,6 +258,8 @@
</li>
<li>[<a href='https://issues.jboss.org/browse/TEIID-2945'>TEIID-2945</a>] - disableLocalTxn only works at connection time
</li>
+<li>[<a href='https://issues.jboss.org/browse/TEIID-2952'>TEIID-2952</a>] - Crypto exception with client/server running on different java versions
+</li>
</ul>
<h4>From 7.7.9</h4>
<ul>
Modified: branches/7.7.x/common-core/src/main/java/org/teiid/core/crypto/DhKeyGenerator.java
===================================================================
--- branches/7.7.x/common-core/src/main/java/org/teiid/core/crypto/DhKeyGenerator.java 2014-05-01 15:58:50 UTC (rev 4638)
+++ branches/7.7.x/common-core/src/main/java/org/teiid/core/crypto/DhKeyGenerator.java 2014-05-09 13:44:17 UTC (rev 4639)
@@ -119,7 +119,13 @@
ka.init(privateKey);
ka.doPhase(publicKey, true);
byte[] secret = ka.generateSecret();
-
+ //we expect a 1024-bit DH key, but vms handle leading zeros differently
+ if (secret.length < 128) {
+ byte[] temp = new byte[128];
+ System.arraycopy(secret, 0, temp, 128-secret.length, secret.length);
+ secret = temp;
+ }
+ //convert to expected bit length for AES
MessageDigest sha = MessageDigest.getInstance(DIGEST);
byte[] hash = sha.digest(secret);
byte[] symKey = new byte[keySize / 8];