Repository: cxf Updated Branches: refs/heads/3.0.x-fixes c2f576983 -> 39d4f6aeb
Fixing one of OAuth2 tests with IBM JDK, disabling another one Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/39d4f6ae Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/39d4f6ae Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/39d4f6ae Branch: refs/heads/3.0.x-fixes Commit: 39d4f6aebb967179ad97718612a70e3406024a09 Parents: c2f5769 Author: Sergey Beryozkin <[email protected]> Authored: Mon Dec 29 13:18:44 2014 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Mon Dec 29 13:18:44 2014 +0000 ---------------------------------------------------------------------- .../java/org/apache/cxf/common/util/crypto/CryptoUtils.java | 7 ++----- .../cxf/rs/security/oauth2/utils/crypto/CryptoUtilsTest.java | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/39d4f6ae/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java b/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java index 7410182..0be4a19 100644 --- a/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java +++ b/core/src/main/java/org/apache/cxf/common/util/crypto/CryptoUtils.java @@ -82,9 +82,7 @@ public final class CryptoUtils { public static String encryptSecretKey(SecretKey secretKey, PublicKey publicKey, KeyProperties props) throws SecurityException { - byte[] encryptedBytes = encryptBytes(secretKey.getEncoded(), - publicKey, - props); + byte[] encryptedBytes = wrapSecretKey(secretKey, publicKey, props); return encodeBytes(encryptedBytes); } @@ -603,8 +601,7 @@ public final class CryptoUtils { KeyProperties props, PrivateKey privateKey) throws SecurityException { byte[] encryptedBytes = decodeSequence(encodedEncryptedSecretKey); - byte[] descryptedBytes = decryptBytes(encryptedBytes, privateKey, props); - return createSecretKeySpec(descryptedBytes, secretKeyAlgo); + return unwrapSecretKey(encryptedBytes, secretKeyAlgo, privateKey, props); } public static SecretKey createSecretKeySpec(String encodedBytes, String algo) { http://git-wip-us.apache.org/repos/asf/cxf/blob/39d4f6ae/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtilsTest.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtilsTest.java b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtilsTest.java index bf05c13..72dede2 100644 --- a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtilsTest.java +++ b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/utils/crypto/CryptoUtilsTest.java @@ -133,7 +133,9 @@ public class CryptoUtilsTest extends Assert { @Test public void testBearerTokenJSONCertificate() throws Exception { - + if ("IBM Corporation".equals(System.getProperty("java.vendor"))) { + return; + } KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); KeyPair keyPair = kpg.generateKeyPair(); PublicKey publicKey = keyPair.getPublic();
