cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: Minor updates to the JWE code
Date Wed, 17 Jun 2015 16:47:39 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 90451dc32 -> a83b3680b


Minor updates to the JWE code


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a83b3680
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a83b3680
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a83b3680

Branch: refs/heads/3.0.x-fixes
Commit: a83b3680b6cb805c38eddcf3389993f7d8c1e40f
Parents: 90451dc
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Wed Jun 17 17:45:08 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Wed Jun 17 17:47:26 2015 +0100

----------------------------------------------------------------------
 .../jwe/AesGcmContentEncryptionAlgorithm.java   |  3 ++
 .../jose/jwe/DirectKeyDecryptionAlgorithm.java  |  4 +++
 .../jose/jwe/DirectKeyJweDecryption.java        | 32 ++++++++++++++++++++
 .../jose/jwe/DirectKeyJweEncryption.java        | 27 +++++++++++++++++
 4 files changed, 66 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a83b3680/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentEncryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentEncryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentEncryptionAlgorithm.java
index 1c53a82..4f87829 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentEncryptionAlgorithm.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/AesGcmContentEncryptionAlgorithm.java
@@ -33,6 +33,9 @@ public class AesGcmContentEncryptionAlgorithm extends AbstractContentEncryptionA
     public AesGcmContentEncryptionAlgorithm(String encodedCek, String encodedIv, ContentAlgorithm
algo) {
         this((byte[])CryptoUtils.decodeSequence(encodedCek), CryptoUtils.decodeSequence(encodedIv),
algo);
     }
+    public AesGcmContentEncryptionAlgorithm(String encodedCek, ContentAlgorithm algo) {
+        this((byte[])CryptoUtils.decodeSequence(encodedCek), null, algo);
+    }
     public AesGcmContentEncryptionAlgorithm(SecretKey key, byte[] iv, ContentAlgorithm algo)
{ 
         this(key.getEncoded(), iv, algo);    
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/a83b3680/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
----------------------------------------------------------------------
diff --git a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
index 6bf953d..3f19e6a 100644
--- a/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyDecryptionAlgorithm.java
@@ -23,6 +23,7 @@ import java.util.logging.Logger;
 
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.rs.security.jose.jwa.KeyAlgorithm;
+import org.apache.cxf.rt.security.crypto.CryptoUtils;
 
 public class DirectKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm {
     private static final Logger LOG = LogUtils.getL7dLogger(DirectKeyDecryptionAlgorithm.class);
@@ -30,6 +31,9 @@ public class DirectKeyDecryptionAlgorithm implements KeyDecryptionAlgorithm
{
     public DirectKeyDecryptionAlgorithm(Key contentDecryptionKey) {    
         this(contentDecryptionKey.getEncoded());
     }
+    public DirectKeyDecryptionAlgorithm(String encodedContentDecryptionKey) {    
+        this(CryptoUtils.decodeSequence(encodedContentDecryptionKey));
+    }
     public DirectKeyDecryptionAlgorithm(byte[] contentDecryptionKey) {    
         this.contentDecryptionKey = contentDecryptionKey;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/a83b3680/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
new file mode 100644
index 0000000..afc6d8a
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweDecryption.java
@@ -0,0 +1,32 @@
+/**
+ * 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 DirectKeyJweDecryption extends JweDecryption {
+    public DirectKeyJweDecryption(String encodedKey, ContentDecryptionAlgorithm ctAlgo) {
+        super(new DirectKeyDecryptionAlgorithm(encodedKey), 
+              ctAlgo);
+    }
+    public DirectKeyJweDecryption(byte[] key, ContentDecryptionAlgorithm ctAlgo) {
+        super(new DirectKeyDecryptionAlgorithm(key), 
+              ctAlgo);
+    }
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/a83b3680/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
new file mode 100644
index 0000000..3c83466
--- /dev/null
+++ b/rt/rs/security/jose/src/main/java/org/apache/cxf/rs/security/jose/jwe/DirectKeyJweEncryption.java
@@ -0,0 +1,27 @@
+/**
+ * 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 JweEncryption {
+    public DirectKeyJweEncryption(ContentEncryptionProvider contentEncryptionAlgo) {
+        super(new DirectKeyEncryptionAlgorithm(), contentEncryptionAlgo);
+    }
+}


Mime
View raw message