You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2014/10/20 10:27:08 UTC

git commit: [SSHD-365] Add AES-192-CTR cipher support

Repository: mina-sshd
Updated Branches:
  refs/heads/master d4a524e42 -> 826bc982f


[SSHD-365] Add AES-192-CTR cipher support

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/826bc982
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/826bc982
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/826bc982

Branch: refs/heads/master
Commit: 826bc982fe7bbca2aa6a696a01f4d029a583c8bc
Parents: d4a524e
Author: Guillaume Nodet <gn...@apache.org>
Authored: Mon Oct 20 10:20:01 2014 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Mon Oct 20 10:20:01 2014 +0200

----------------------------------------------------------------------
 .../main/java/org/apache/sshd/SshBuilder.java   |  2 +
 .../apache/sshd/common/cipher/AES192CTR.java    | 47 ++++++++++++++++++++
 .../sshd/common/cipher/AES192CTRTest.java       | 38 ++++++++++++++++
 3 files changed, 87 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/826bc982/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java b/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java
index e62e30e..0844152 100644
--- a/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java
+++ b/sshd-core/src/main/java/org/apache/sshd/SshBuilder.java
@@ -41,6 +41,7 @@ import org.apache.sshd.common.TcpipForwarderFactory;
 import org.apache.sshd.common.cipher.AES128CBC;
 import org.apache.sshd.common.cipher.AES128CTR;
 import org.apache.sshd.common.cipher.AES192CBC;
+import org.apache.sshd.common.cipher.AES192CTR;
 import org.apache.sshd.common.cipher.AES256CBC;
 import org.apache.sshd.common.cipher.AES256CTR;
 import org.apache.sshd.common.cipher.ARCFOUR128;
@@ -261,6 +262,7 @@ public class SshBuilder {
         protected static List<NamedFactory<Cipher>> setUpDefaultCiphers() {
             List<NamedFactory<Cipher>> avail = new LinkedList<NamedFactory<Cipher>>();
             avail.add(new AES128CTR.Factory());
+            avail.add(new AES192CTR.Factory());
             avail.add(new AES256CTR.Factory());
             avail.add(new ARCFOUR128.Factory());
             avail.add(new ARCFOUR256.Factory());

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/826bc982/sshd-core/src/main/java/org/apache/sshd/common/cipher/AES192CTR.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/common/cipher/AES192CTR.java b/sshd-core/src/main/java/org/apache/sshd/common/cipher/AES192CTR.java
new file mode 100644
index 0000000..d44c06c
--- /dev/null
+++ b/sshd-core/src/main/java/org/apache/sshd/common/cipher/AES192CTR.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sshd.common.cipher;
+
+import org.apache.sshd.common.Cipher;
+import org.apache.sshd.common.NamedFactory;
+
+/**
+ * AES192CBC Cipher
+ *
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class AES192CTR extends BaseCipher {
+
+    /**
+     * Named factory for AES192CBC Cipher
+     */
+    public static class Factory implements NamedFactory<Cipher> {
+        public String getName() {
+            return "aes192-ctr";
+        }
+        public Cipher create() {
+            return new AES192CTR();
+        }
+    }
+
+    public AES192CTR() {
+        super(16, 24, "AES", "AES/CTR/NoPadding");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/826bc982/sshd-core/src/test/java/org/apache/sshd/common/cipher/AES192CTRTest.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/test/java/org/apache/sshd/common/cipher/AES192CTRTest.java b/sshd-core/src/test/java/org/apache/sshd/common/cipher/AES192CTRTest.java
new file mode 100644
index 0000000..12c3e97
--- /dev/null
+++ b/sshd-core/src/test/java/org/apache/sshd/common/cipher/AES192CTRTest.java
@@ -0,0 +1,38 @@
+/*
+ * 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.sshd.common.cipher;
+
+import org.junit.Test;
+
+/**
+ * @author <a href="mailto:dev@mina.apache.org">Apache MINA SSHD Project</a>
+ */
+public class AES192CTRTest extends BaseCipherTest {
+	public AES192CTRTest() {
+		super();
+	}
+
+	@Test
+	public void testEncryptDecrypt() throws Exception {
+		// for AES 256 bits we need the JCE unlimited strength policy
+		ensureKeySizeSupported(16, 24, "AES", "AES/CTR/NoPadding");
+		testEncryptDecrypt(new AES192CTR.Factory());
+	}
+}