Repository: cxf Updated Branches: refs/heads/master bac8c8dae -> 5ec2f2fa4
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/5ec2f2fa Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5ec2f2fa Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5ec2f2fa Branch: refs/heads/master Commit: 5ec2f2fa4dc1f0b047896623f599642fb894c947 Parents: bac8c8d Author: Sergey Beryozkin <[email protected]> Authored: Mon Dec 29 13:18:44 2014 +0000 Committer: Sergey Beryozkin <[email protected]> Committed: Mon Dec 29 13:22:22 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/5ec2f2fa/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 b3017cb..2408a0b 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 @@ -80,9 +80,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); } @@ -587,8 +585,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/5ec2f2fa/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();
