Return-Path: X-Original-To: apmail-cxf-commits-archive@www.apache.org Delivered-To: apmail-cxf-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C660C104A9 for ; Mon, 16 Feb 2015 16:10:20 +0000 (UTC) Received: (qmail 48072 invoked by uid 500); 16 Feb 2015 16:10:04 -0000 Delivered-To: apmail-cxf-commits-archive@cxf.apache.org Received: (qmail 47845 invoked by uid 500); 16 Feb 2015 16:10:04 -0000 Mailing-List: contact commits-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list commits@cxf.apache.org Received: (qmail 47660 invoked by uid 99); 16 Feb 2015 16:10:04 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Feb 2015 16:10:04 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B0848E02D9; Mon, 16 Feb 2015 16:10:04 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sergeyb@apache.org To: commits@cxf.apache.org Message-Id: <2fbdfb1bd0eb4f6eabf5ae8a9e776333@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: cxf git commit: Removing and renaming some of JWE classes Date: Mon, 16 Feb 2015 16:10:04 +0000 (UTC) Repository: cxf Updated Branches: refs/heads/3.0.x-fixes a06642ec7 -> 5c2cd0ac3 Removing and renaming some of JWE classes Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/5c2cd0ac Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/5c2cd0ac Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/5c2cd0ac Branch: refs/heads/3.0.x-fixes Commit: 5c2cd0ac344218ef834a178d42fa38775d056243 Parents: a06642e Author: Sergey Beryozkin Authored: Mon Feb 16 16:08:40 2015 +0000 Committer: Sergey Beryozkin Committed: Mon Feb 16 16:09:47 2015 +0000 ---------------------------------------------------------------------- .../jose/jwe/DirectKeyJweDecryption.java | 34 --------------- .../jose/jwe/DirectKeyJweEncryption.java | 44 -------------------- .../jose/jwe/EcdhDirectKeyJweDecryption.java | 2 +- .../jose/jwe/EcdhDirectKeyJweEncryption.java | 8 ++-- .../cxf/rs/security/jose/jwe/JweDecryption.java | 28 +++++++++++++ .../cxf/rs/security/jose/jwe/JweEncryption.java | 29 +++++++++++++ .../cxf/rs/security/jose/jwe/JweUtils.java | 31 +++++++------- .../jose/jwe/WrappedKeyJweDecryption.java | 28 ------------- .../jose/jwe/WrappedKeyJweEncryption.java | 29 ------------- .../jose/jwe/JweCompactReaderWriterTest.java | 8 ++-- .../security/jose/jwe/JweJsonProducerTest.java | 4 +- .../jose/jwe/JwePbeHmacAesWrapTest.java | 4 +- 12 files changed, 87 insertions(+), 162 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java deleted file mode 100644 index 6a98e46..0000000 --- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.rs.security.jose.jwe; - -import java.security.Key; - -public class DirectKeyJweDecryption extends AbstractJweDecryption { - public DirectKeyJweDecryption(Key contentDecryptionKey, - ContentDecryptionAlgorithm cipherProps) { - this(new DirectKeyDecryptionAlgorithm(contentDecryptionKey), - cipherProps); - } - protected DirectKeyJweDecryption(DirectKeyDecryptionAlgorithm direct, - ContentDecryptionAlgorithm cipherProps) { - super(direct, cipherProps); - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweEncryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweEncryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweEncryption.java deleted file mode 100644 index 5a951e1..0000000 --- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweEncryption.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.rs.security.jose.jwe; - - -public class DirectKeyJweEncryption extends AbstractJweEncryption { - - public DirectKeyJweEncryption(ContentEncryptionAlgorithm ceAlgo) { - this(ceAlgo, new DirectKeyEncryptionAlgorithm()); - } - protected DirectKeyJweEncryption(ContentEncryptionAlgorithm ceAlgo, - DirectKeyEncryptionAlgorithm direct) { - super(ceAlgo, direct); - } - @Override - protected byte[] getProvidedContentEncryptionKey(JweHeaders headers) { - return validateCek(super.getProvidedContentEncryptionKey(headers)); - } - private static byte[] validateCek(byte[] cek) { - if (cek == null) { - // to prevent the cek from being auto-generated which - // does not make sense for the direct key case - throw new NullPointerException("CEK must not be null"); - } - return cek; - } - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java index 584c54f..7284def 100644 --- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java +++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweDecryption.java @@ -26,7 +26,7 @@ import org.apache.cxf.rs.security.jose.jwk.JsonWebKey; import org.apache.cxf.rs.security.jose.jwk.JwkUtils; -public class EcdhDirectKeyJweDecryption extends DirectKeyJweDecryption { +public class EcdhDirectKeyJweDecryption extends JweDecryption { public EcdhDirectKeyJweDecryption(ECPrivateKey privateKey, String supportedCtAlgo) { super(new EcdhDirectKeyDecryptionAlgorithm(privateKey), new AesGcmContentDecryptionAlgorithm(supportedCtAlgo)); http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweEncryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweEncryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweEncryption.java index aa18988..5264dff 100644 --- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweEncryption.java +++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/EcdhDirectKeyJweEncryption.java @@ -30,18 +30,18 @@ import org.apache.cxf.rs.security.jose.jwa.Algorithm; import org.apache.cxf.rs.security.jose.jwk.JwkUtils; -public class EcdhDirectKeyJweEncryption extends DirectKeyJweEncryption { +public class EcdhDirectKeyJweEncryption extends JweEncryption { public EcdhDirectKeyJweEncryption(ECPublicKey peerPublicKey, String curve, String apuString, String apvString, String ctAlgo) { - super(new EcdhAesGcmContentEncryptionAlgorithm(peerPublicKey, + super(new EcdhDirectKeyEncryptionAlgorithm(), + new EcdhAesGcmContentEncryptionAlgorithm(peerPublicKey, curve, apuString, apvString, - ctAlgo), - new EcdhDirectKeyEncryptionAlgorithm()); + ctAlgo)); } protected static class EcdhDirectKeyEncryptionAlgorithm extends DirectKeyEncryptionAlgorithm { protected void checkKeyEncryptionAlgorithm(JweHeaders headers) { http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java new file mode 100644 index 0000000..9642354 --- /dev/null +++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweDecryption.java @@ -0,0 +1,28 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.rs.security.jose.jwe; + + +public class JweDecryption extends AbstractJweDecryption { + + public JweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo, + ContentDecryptionAlgorithm cipherProps) { + super(keyDecryptionAlgo, cipherProps); + } +} http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweEncryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweEncryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweEncryption.java new file mode 100644 index 0000000..00d994e --- /dev/null +++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweEncryption.java @@ -0,0 +1,29 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.cxf.rs.security.jose.jwe; + + +public class JweEncryption extends AbstractJweEncryption { + public JweEncryption(KeyEncryptionAlgorithm keyEncryptionAlgorithm, + ContentEncryptionAlgorithm contentEncryptionAlgo) { + super(contentEncryptionAlgo, keyEncryptionAlgorithm); + } + + +} http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java index 950efdf..c0a2b45 100644 --- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java +++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/JweUtils.java @@ -211,18 +211,21 @@ public final class JweUtils { } return null; } - public static DirectKeyJweEncryption getDirectKeyJweEncryption(JsonWebKey key) { - return new DirectKeyJweEncryption(getContentEncryptionAlgorithm(key, key.getAlgorithm())); + public static JweEncryption getDirectKeyJweEncryption(JsonWebKey key) { + return new JweEncryption(new DirectKeyEncryptionAlgorithm(), + getContentEncryptionAlgorithm(key, key.getAlgorithm())); } - public static DirectKeyJweEncryption getDirectKeyJweEncryption(SecretKey key, String algorithm) { - return new DirectKeyJweEncryption(getContentEncryptionAlgorithm(key, algorithm)); + public static JweEncryption getDirectKeyJweEncryption(SecretKey key, String algorithm) { + return new JweEncryption(new DirectKeyEncryptionAlgorithm(), + getContentEncryptionAlgorithm(key, algorithm)); } - public static DirectKeyJweDecryption getDirectKeyJweDecryption(SecretKey key, String algorithm) { - return new DirectKeyJweDecryption(key, getContentDecryptionAlgorithm(algorithm)); + public static JweDecryption getDirectKeyJweDecryption(SecretKey key, String algorithm) { + return new JweDecryption(new DirectKeyDecryptionAlgorithm(key), + getContentDecryptionAlgorithm(algorithm)); } - public static DirectKeyJweDecryption getDirectKeyJweDecryption(JsonWebKey key) { - return new DirectKeyJweDecryption(JwkUtils.toSecretKey(key), - getContentDecryptionAlgorithm(key.getAlgorithm())); + public static JweDecryption getDirectKeyJweDecryption(JsonWebKey key) { + return new JweDecryption(new DirectKeyDecryptionAlgorithm(JwkUtils.toSecretKey(key)), + getContentDecryptionAlgorithm(key.getAlgorithm())); } public static JweEncryptionProvider loadEncryptionProvider(boolean required) { return loadEncryptionProvider(null, required); @@ -362,8 +365,8 @@ public final class JweUtils { if (Algorithm.isAesCbcHmac(contentEncryptionAlgo)) { return new AesCbcHmacJweEncryption(contentEncryptionAlgo, keyEncryptionProvider); } else { - return new WrappedKeyJweEncryption(keyEncryptionProvider, - getContentEncryptionAlgorithm(contentEncryptionAlgo)); + return new JweEncryption(keyEncryptionProvider, + getContentEncryptionAlgorithm(contentEncryptionAlgo)); } } public static JweDecryptionProvider createJweDecryptionProvider(RSAPrivateKey key, @@ -385,8 +388,8 @@ public final class JweUtils { if (Algorithm.isAesCbcHmac(contentDecryptionAlgo)) { return new AesCbcHmacJweDecryption(keyDecryptionProvider, contentDecryptionAlgo); } else { - return new WrappedKeyJweDecryption(keyDecryptionProvider, - getContentDecryptionAlgorithm(contentDecryptionAlgo)); + return new JweDecryption(keyDecryptionProvider, + getContentDecryptionAlgorithm(contentDecryptionAlgo)); } } public static boolean validateCriticalHeaders(JoseHeaders headers) { @@ -508,7 +511,7 @@ public final class JweUtils { if (keyEncryptionProvider != null) { return createJweEncryptionProvider(keyEncryptionProvider, headers); } else { - return new DirectKeyJweEncryption(ctEncryptionProvider); + return new JweEncryption(new DirectKeyEncryptionAlgorithm(), ctEncryptionProvider); } } private static JweDecryptionProvider createJweDecryptionProvider(KeyDecryptionAlgorithm keyDecryptionProvider, http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java deleted file mode 100644 index 4944151..0000000 --- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweDecryption.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.rs.security.jose.jwe; - - -public class WrappedKeyJweDecryption extends AbstractJweDecryption { - - public WrappedKeyJweDecryption(KeyDecryptionAlgorithm keyDecryptionAlgo, - ContentDecryptionAlgorithm cipherProps) { - super(keyDecryptionAlgo, cipherProps); - } -} http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java deleted file mode 100644 index 04c5a8b..0000000 --- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/WrappedKeyJweEncryption.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.cxf.rs.security.jose.jwe; - - -public class WrappedKeyJweEncryption extends AbstractJweEncryption { - public WrappedKeyJweEncryption(KeyEncryptionAlgorithm keyEncryptionAlgorithm, - ContentEncryptionAlgorithm contentEncryptionAlgo) { - super(contentEncryptionAlgo, keyEncryptionAlgorithm); - } - - -} http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java index 38d5719..407af79 100644 --- a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java +++ b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweCompactReaderWriterTest.java @@ -250,11 +250,11 @@ public class JweCompactReaderWriterTest extends Assert { Algorithm.RSA_OAEP.getJwtName()); ContentEncryptionAlgorithm contentEncryptionAlgo = new AesGcmContentEncryptionAlgorithm(key == null ? null : key.getEncoded(), INIT_VECTOR_A1, jwtKeyName); - JweEncryptionProvider encryptor = new WrappedKeyJweEncryption(keyEncryptionAlgo, contentEncryptionAlgo); + JweEncryptionProvider encryptor = new JweEncryption(keyEncryptionAlgo, contentEncryptionAlgo); return encryptor.encrypt(content.getBytes("UTF-8"), null); } private String encryptContentDirect(SecretKey key, String content) throws Exception { - DirectKeyJweEncryption encryptor = new DirectKeyJweEncryption( + JweEncryption encryptor = new JweEncryption(new DirectKeyEncryptionAlgorithm(), new AesGcmContentEncryptionAlgorithm(key, INIT_VECTOR_A1, JoseConstants.A128GCM_ALGO)); return encryptor.encrypt(content.getBytes("UTF-8"), null); } @@ -263,13 +263,13 @@ public class JweCompactReaderWriterTest extends Assert { RSA_PRIVATE_EXPONENT_ENCODED_A1); String algo = Cipher.getMaxAllowedKeyLength("AES") > 128 ? JoseConstants.A256GCM_ALGO : JoseConstants.A128GCM_ALGO; - JweDecryptionProvider decryptor = new WrappedKeyJweDecryption(new RSAKeyDecryptionAlgorithm(privateKey), + JweDecryptionProvider decryptor = new JweDecryption(new RSAKeyDecryptionAlgorithm(privateKey), new AesGcmContentDecryptionAlgorithm(algo)); String decryptedText = decryptor.decrypt(jweContent).getContentText(); assertEquals(decryptedText, plainContent); } private void decryptDirect(SecretKey key, String jweContent, String plainContent) throws Exception { - DirectKeyJweDecryption decryptor = new DirectKeyJweDecryption(key, + JweDecryption decryptor = new JweDecryption(new DirectKeyDecryptionAlgorithm(key), new AesGcmContentDecryptionAlgorithm(JoseConstants.A128GCM_ALGO)); String decryptedText = decryptor.decrypt(jweContent).getContentText(); assertEquals(decryptedText, plainContent); http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweJsonProducerTest.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweJsonProducerTest.java b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweJsonProducerTest.java index 175c2de..8c473c7 100644 --- a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweJsonProducerTest.java +++ b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JweJsonProducerTest.java @@ -307,10 +307,10 @@ public class JweJsonProducerTest extends Assert { JweUtils.getSecretKeyEncryptionAlgorithm(wrapperKey1, JoseConstants.A128KW_ALGO); ContentEncryptionAlgorithm contentEncryption = JweUtils.getContentEncryptionAlgorithm(JoseConstants.A128GCM_ALGO); - JweEncryptionProvider jwe1 = new WrappedKeyJweEncryption(keyEncryption1, contentEncryption); + JweEncryptionProvider jwe1 = new JweEncryption(keyEncryption1, contentEncryption); KeyEncryptionAlgorithm keyEncryption2 = JweUtils.getSecretKeyEncryptionAlgorithm(wrapperKey2, JoseConstants.A128KW_ALGO); - JweEncryptionProvider jwe2 = new WrappedKeyJweEncryption(keyEncryption2, contentEncryption); + JweEncryptionProvider jwe2 = new JweEncryption(keyEncryption2, contentEncryption); jweList.add(jwe1); jweList.add(jwe2); http://git-wip-us.apache.org/repos/asf/cxf/blob/5c2cd0ac/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java ---------------------------------------------------------------------- diff --git a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java index 8d9f5a2..8378638 100644 --- a/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java +++ b/rt/rs/security/jose/src/test/java/org/apache/cxf/rs/security/jose/jwe/JwePbeHmacAesWrapTest.java @@ -72,11 +72,11 @@ public class JwePbeHmacAesWrapTest extends Assert { final String password = "Thus from my lips, by yours, my sin is purged."; KeyEncryptionAlgorithm keyEncryption = new PbesHmacAesWrapKeyEncryptionAlgorithm(password, JoseConstants.PBES2_HS256_A128KW_ALGO); - JweEncryptionProvider encryption = new WrappedKeyJweEncryption(keyEncryption, + JweEncryptionProvider encryption = new JweEncryption(keyEncryption, new AesGcmContentEncryptionAlgorithm(Algorithm.A128GCM.getJwtName())); String jweContent = encryption.encrypt(specPlainText.getBytes("UTF-8"), null); PbesHmacAesWrapKeyDecryptionAlgorithm keyDecryption = new PbesHmacAesWrapKeyDecryptionAlgorithm(password); - JweDecryptionProvider decryption = new WrappedKeyJweDecryption(keyDecryption, + JweDecryptionProvider decryption = new JweDecryption(keyDecryption, new AesGcmContentDecryptionAlgorithm(JoseConstants.A128GCM_ALGO)); String decryptedText = decryption.decrypt(jweContent).getContentText(); assertEquals(specPlainText, decryptedText);