commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From x..@apache.org
Subject [8/8] commons-crypto git commit: CRYPTO-7: Rename source code in Chimera to Apache name space
Date Fri, 22 Apr 2016 05:18:36 GMT
CRYPTO-7: Rename source code in Chimera to Apache name space

Update some typos in README


Project: http://git-wip-us.apache.org/repos/asf/commons-crypto/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-crypto/commit/4920d272
Tree: http://git-wip-us.apache.org/repos/asf/commons-crypto/tree/4920d272
Diff: http://git-wip-us.apache.org/repos/asf/commons-crypto/diff/4920d272

Branch: refs/heads/master
Commit: 4920d2729c0b3eb492c5fd9f890a463996eb2ea9
Parents: 92d129a
Author: Ferdinand Xu <cheng.a.xu@intel.com>
Authored: Fri Apr 15 08:47:50 2016 +0800
Committer: Ferdinand Xu <cheng.a.xu@intel.com>
Committed: Fri Apr 22 05:56:25 2016 +0800

----------------------------------------------------------------------
 Makefile                                        |  18 +-
 Makefile.common                                 |  14 +-
 README.md                                       |  20 +-
 pom.xml                                         |   6 +-
 src/main/java/com/intel/chimera/VERSION         |   1 -
 .../java/com/intel/chimera/cipher/Cipher.java   | 155 ------
 .../com/intel/chimera/cipher/CipherFactory.java | 105 -----
 .../chimera/cipher/CipherTransformation.java    |  96 ----
 .../com/intel/chimera/cipher/JceCipher.java     | 207 --------
 .../java/com/intel/chimera/cipher/Openssl.java  | 320 -------------
 .../com/intel/chimera/cipher/OpensslCipher.java | 196 --------
 .../com/intel/chimera/cipher/OpensslNative.java | 116 -----
 .../com/intel/chimera/cipher/package-info.java  |  22 -
 .../intel/chimera/conf/ConfigurationKeys.java   | 139 ------
 .../com/intel/chimera/conf/package-info.java    |  21 -
 .../intel/chimera/random/JavaSecureRandom.java  |  73 ---
 .../chimera/random/OpensslSecureRandom.java     | 140 ------
 .../random/OpensslSecureRandomNative.java       |  40 --
 .../intel/chimera/random/OsSecureRandom.java    | 133 ------
 .../com/intel/chimera/random/SecureRandom.java  |  36 --
 .../chimera/random/SecureRandomFactory.java     |  72 ---
 .../com/intel/chimera/random/package-info.java  |  21 -
 .../chimera/stream/CTRCryptoInputStream.java    | 423 -----------------
 .../chimera/stream/CTRCryptoOutputStream.java   | 230 ---------
 .../intel/chimera/stream/CryptoInputStream.java | 394 ----------------
 .../chimera/stream/CryptoOutputStream.java      | 283 -----------
 .../stream/PositionedCryptoInputStream.java     | 311 ------------
 .../chimera/stream/input/ChannelInput.java      | 165 -------
 .../com/intel/chimera/stream/input/Input.java   | 133 ------
 .../intel/chimera/stream/input/StreamInput.java | 164 -------
 .../chimera/stream/output/ChannelOutput.java    |  78 ----
 .../com/intel/chimera/stream/output/Output.java |  76 ---
 .../chimera/stream/output/StreamOutput.java     | 101 ----
 .../java/com/intel/chimera/utils/IOUtils.java   |  96 ----
 .../intel/chimera/utils/NativeCodeLoader.java   | 279 -----------
 .../java/com/intel/chimera/utils/OSInfo.java    | 190 --------
 .../intel/chimera/utils/ReflectionUtils.java    | 204 --------
 .../java/com/intel/chimera/utils/Utils.java     | 362 --------------
 .../com/intel/chimera/utils/package-info.java   |  21 -
 src/main/java/org/apache/commons/crypto/VERSION |   1 +
 .../apache/commons/crypto/cipher/Cipher.java    | 155 ++++++
 .../commons/crypto/cipher/CipherFactory.java    | 105 +++++
 .../crypto/cipher/CipherTransformation.java     |  96 ++++
 .../apache/commons/crypto/cipher/JceCipher.java | 207 ++++++++
 .../apache/commons/crypto/cipher/Openssl.java   | 320 +++++++++++++
 .../commons/crypto/cipher/OpensslCipher.java    | 196 ++++++++
 .../commons/crypto/cipher/OpensslNative.java    | 116 +++++
 .../commons/crypto/cipher/package-info.java     |  22 +
 .../commons/crypto/conf/ConfigurationKeys.java  | 139 ++++++
 .../commons/crypto/conf/package-info.java       |  21 +
 .../commons/crypto/random/JavaSecureRandom.java |  73 +++
 .../crypto/random/OpensslSecureRandom.java      | 140 ++++++
 .../random/OpensslSecureRandomNative.java       |  40 ++
 .../commons/crypto/random/OsSecureRandom.java   | 133 ++++++
 .../commons/crypto/random/SecureRandom.java     |  36 ++
 .../crypto/random/SecureRandomFactory.java      |  72 +++
 .../commons/crypto/random/package-info.java     |  21 +
 .../crypto/stream/CTRCryptoInputStream.java     | 423 +++++++++++++++++
 .../crypto/stream/CTRCryptoOutputStream.java    | 230 +++++++++
 .../crypto/stream/CryptoInputStream.java        | 394 ++++++++++++++++
 .../crypto/stream/CryptoOutputStream.java       | 283 +++++++++++
 .../stream/PositionedCryptoInputStream.java     | 311 ++++++++++++
 .../crypto/stream/input/ChannelInput.java       | 165 +++++++
 .../commons/crypto/stream/input/Input.java      | 133 ++++++
 .../crypto/stream/input/StreamInput.java        | 164 +++++++
 .../crypto/stream/output/ChannelOutput.java     |  78 ++++
 .../commons/crypto/stream/output/Output.java    |  76 +++
 .../crypto/stream/output/StreamOutput.java      | 101 ++++
 .../apache/commons/crypto/utils/IOUtils.java    |  96 ++++
 .../commons/crypto/utils/NativeCodeLoader.java  | 279 +++++++++++
 .../org/apache/commons/crypto/utils/OSInfo.java | 190 ++++++++
 .../commons/crypto/utils/ReflectionUtils.java   | 204 ++++++++
 .../org/apache/commons/crypto/utils/Utils.java  | 362 ++++++++++++++
 .../commons/crypto/utils/package-info.java      |  21 +
 .../com/intel/chimera/cipher/OpensslNative.c    | 467 -------------------
 .../com/intel/chimera/com_intel_chimera.h       | 228 ---------
 src/main/native/com/intel/chimera/exception.c   | 124 -----
 src/main/native/com/intel/chimera/exception.h   | 104 -----
 .../chimera/random/OpensslSecureRandomNative.c  | 335 -------------
 .../chimera/random/com_intel_chimera_random.h   |  40 --
 .../commons/crypto/cipher/OpensslNative.c       | 467 +++++++++++++++++++
 .../org/apache/commons/crypto/exception.c       | 124 +++++
 .../org/apache/commons/crypto/exception.h       | 104 +++++
 .../commons/crypto/org_apache_commons_crypto.h  | 228 +++++++++
 .../crypto/random/OpensslSecureRandomNative.c   | 335 +++++++++++++
 .../random/org_apache_commons_crypto_random.h   |  40 ++
 .../chimera/cipher/AbstractCipherTest.java      | 242 ----------
 .../com/intel/chimera/cipher/JceCipherTest.java |  32 --
 .../intel/chimera/cipher/OpensslCipherTest.java | 165 -------
 .../java/com/intel/chimera/cipher/TestData.java | 160 -------
 .../chimera/random/AbstractRandomTest.java      |  57 ---
 .../chimera/random/TestJavaSecureRandom.java    |  40 --
 .../chimera/random/TestOpensslSecureRandom.java |  40 --
 .../chimera/random/TestOsSecureRandom.java      |  29 --
 .../stream/AbstractCryptoStreamTest.java        | 456 ------------------
 .../stream/CBCNoPaddingCryptoStreamTest.java    |  31 --
 .../stream/CBCPKCS5PaddingCryptoStreamTest.java |  30 --
 .../chimera/stream/CTRCryptoStreamTest.java     |  58 ---
 .../stream/CTRNoPaddingCryptoStreamTest.java    |  31 --
 .../stream/PositionedCryptoInputStreamTest.java | 381 ---------------
 .../java/com/intel/chimera/utils/UtilsTest.java |  40 --
 .../crypto/cipher/AbstractCipherTest.java       | 242 ++++++++++
 .../commons/crypto/cipher/JceCipherTest.java    |  32 ++
 .../crypto/cipher/OpensslCipherTest.java        | 165 +++++++
 .../apache/commons/crypto/cipher/TestData.java  | 160 +++++++
 .../crypto/random/AbstractRandomTest.java       |  57 +++
 .../crypto/random/TestJavaSecureRandom.java     |  40 ++
 .../crypto/random/TestOpensslSecureRandom.java  |  40 ++
 .../crypto/random/TestOsSecureRandom.java       |  29 ++
 .../crypto/stream/AbstractCryptoStreamTest.java | 456 ++++++++++++++++++
 .../stream/CBCNoPaddingCryptoStreamTest.java    |  31 ++
 .../stream/CBCPKCS5PaddingCryptoStreamTest.java |  30 ++
 .../crypto/stream/CTRCryptoStreamTest.java      |  58 +++
 .../stream/CTRNoPaddingCryptoStreamTest.java    |  31 ++
 .../stream/PositionedCryptoInputStreamTest.java | 381 +++++++++++++++
 .../apache/commons/crypto/utils/UtilsTest.java  |  40 ++
 116 files changed, 8522 insertions(+), 8522 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/Makefile
----------------------------------------------------------------------
diff --git a/Makefile b/Makefile
index e0a605e..8309b5c 100644
--- a/Makefile
+++ b/Makefile
@@ -11,30 +11,30 @@ else
   TAR:= tar
 endif
 
-NATIVE_TARGET_DIR:=$(TARGET)/classes/com/intel/chimera/native/$(OS_NAME)/$(OS_ARCH)
+NATIVE_TARGET_DIR:=$(TARGET)/classes/org/apache/commons/crypto/native/$(OS_NAME)/$(OS_ARCH)
 NATIVE_DLL:=$(NATIVE_TARGET_DIR)/$(LIBNAME)
 
 all: $(NATIVE_DLL)
 
-$(TARGET)/jni-classes/com/intel/chimera/cipher/OpensslNative.class : $(SRC)/com/intel/chimera/cipher/OpensslNative.java
+$(TARGET)/jni-classes/org/apache/commons/crypto/cipher/OpensslNative.class : $(SRC)/org/apache/commons/crypto/cipher/OpensslNative.java
 	@mkdir -p $(TARGET)/jni-classes
 	$(JAVAC) -source 1.6 -target 1.6 -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
 
-$(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.class : $(SRC)/com/intel/chimera/random/OpensslSecureRandomNative.java
+$(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.class : $(SRC)/org/apache/commons/crypto/random/OpensslSecureRandomNative.java
 	@mkdir -p $(TARGET)/jni-classes
 	$(JAVAC) -source 1.6 -target 1.6 -d $(TARGET)/jni-classes -sourcepath $(SRC) $<
 
-$(TARGET)/jni-classes/com/intel/chimera/cipher/OpensslNative.h: $(TARGET)/jni-classes/com/intel/chimera/cipher/OpensslNative.class
-	$(JAVAH) -force -classpath $(TARGET)/jni-classes -o $@ com.intel.chimera.cipher.OpensslNative
+$(TARGET)/jni-classes/org/apache/commons/crypto/cipher/OpensslNative.h: $(TARGET)/jni-classes/org/apache/commons/crypto/cipher/OpensslNative.class
+	$(JAVAH) -force -classpath $(TARGET)/jni-classes -o $@ org.apache.commons.crypto.cipher.OpensslNative
 
-$(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.h: $(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.class
-	$(JAVAH) -force -classpath $(TARGET)/jni-classes -o $@ com.intel.chimera.random.OpensslSecureRandomNative
+$(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.h: $(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.class
+	$(JAVAH) -force -classpath $(TARGET)/jni-classes -o $@ org.apache.commons.crypto.random.OpensslSecureRandomNative
 
-$(CHIMERA_OUT)/OpensslNative.o : $(SRC_NATIVE)/com/intel/chimera/cipher/OpensslNative.c $(TARGET)/jni-classes/com/intel/chimera/cipher/OpensslNative.h
+$(CHIMERA_OUT)/OpensslNative.o : $(SRC_NATIVE)/org/apache/commons/crypto/cipher/OpensslNative.c $(TARGET)/jni-classes/org/apache/commons/crypto/cipher/OpensslNative.h
 	@mkdir -p $(@D)
 	$(CC) $(CFLAGS) -c $< -o $@
 
-$(CHIMERA_OUT)/OpensslSecureRandom.o : $(SRC_NATIVE)/com/intel/chimera/random/OpensslSecureRandomNative.c $(TARGET)/jni-classes/com/intel/chimera/random/OpensslSecureRandomNative.h
+$(CHIMERA_OUT)/OpensslSecureRandom.o : $(SRC_NATIVE)/org/apache/commons/crypto/random/OpensslSecureRandomNative.c $(TARGET)/jni-classes/org/apache/commons/crypto/random/OpensslSecureRandomNative.h
 	@mkdir -p $(@D)
 	$(CC) $(CFLAGS) -c $< -o $@
 

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/Makefile.common
----------------------------------------------------------------------
diff --git a/Makefile.common b/Makefile.common
index 2a45bdd..8091727 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -1,7 +1,7 @@
 TARGET:=target
 SRC:=src/main/java
 SRC_NATIVE:=src/main/native
-include $(SRC)/com/intel/chimera/VERSION
+include $(SRC)/org/apache/commons/crypto/VERSION
 
 ifndef JAVA_HOME
 $(error Set JAVA_HOME environment variable)
@@ -12,13 +12,13 @@ JAVA  := "$$JAVA_HOME/bin/java"
 JAVAC := "$$JAVA_HOME/bin/javac" 
 JAVAH := "$$JAVA_HOME/bin/javah"
 
-OSINFO_CLASS := com.intel.chimera.utils.OSInfo
-OSINFO_PROG := lib/com/intel/chimera/utils/OSInfo.class
+OSINFO_CLASS := org.apache.commons.crypto.utils.OSInfo
+OSINFO_PROG := lib/org/apache/commons/crypto/utils/OSInfo.class
 
 ## building OSInfo.java 
 $(info compiling OSInfo.java)
 $(shell mkdir -p lib)
-$(shell $(JAVAC) src/main/java/com/intel/chimera/utils/OSInfo.java -d lib)
+$(shell $(JAVAC) src/main/java/org/apache/commons/crypto/utils/OSInfo.java -d lib)
 
 OS_NAME := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --os)
 OS_ARCH := $(shell $(JAVA) -cp lib $(OSINFO_CLASS) --arch)
@@ -252,9 +252,9 @@ LIBNAME   := $($(os_arch)_LIBNAME)
 CHIMERA_FLAGS := $($(os_arch)_CHIMERA_FLAGS)
 
 
-CFLAGS := $(CFLAGS) -Ilib/include -I/usr/include -I"$(SRC_NATIVE)/com/intel/chimera/"
+CFLAGS := $(CFLAGS) -Ilib/include -I/usr/include -I"$(SRC_NATIVE)/org/apache/commons/crypto/"
 CXXFLAGS := $(CXXFLAGS) -Ilib/include  -I/usr/include
 ifneq ($(jni_include),)
-CFLAGS := $(CFLAGS) -I"$(jni_include)" -I"$(TARGET)/jni-classes/com/intel/chimera/cipher" -I"$(TARGET)/jni-classes/com/intel/chimera/random"
-CXXFLAGS := $(CXXFLAGS) -I"$(jni_include)" -I"$(TARGET)/jni-classes/com/intel/chimera/cipher" -I"$(TARGET)/jni-classes/com/intel/chimera/random"
+CFLAGS := $(CFLAGS) -I"$(jni_include)" -I"$(TARGET)/jni-classes/org/apache/commons/crypto/cipher" -I"$(TARGET)/jni-classes/org/apache/commons/crypto/random"
+CXXFLAGS := $(CXXFLAGS) -I"$(jni_include)" -I"$(TARGET)/jni-classes/org/apache/commons/crypto/cipher" -I"$(TARGET)/jni-classes/org/apache/commons/crypto/random"
 endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e87f014..34845c0 100644
--- a/README.md
+++ b/README.md
@@ -10,17 +10,17 @@ Chimera [![Build Status](https://travis-ci.org/intel-hadoop/chimera.svg?branch=m
   * [Apache License Version 2.0](http://www.apache.org/licenses/LICENSE-2.0). Free for both commercial and non-commercial use.
 
 ## Download
-  * Release version: http://central.maven.org/maven2/com/intel/chimera/chimera/
-  * Snapshot version (the latest beta version): https://oss.sonatype.org/content/repositories/snapshots/com/intel/chimera/chimera/
+  * Release version: http://central.maven.org/maven2/org/apache/commons/crypto/chimera/
+  * Snapshot version (the latest beta version): https://oss.sonatype.org/content/repositories/snapshots/org/apache/commons/crypto/chimera/
 
 ### Using with Maven
-  * Chimera is available from Maven's central repository:  <http://central.maven.org/maven2/com/intel/chimera/chimera>
+  * Chimera is available from Maven's central repository:  <http://central.maven.org/maven2/org/apache/commons/crypto/chimera>
 
 Add the following dependency to your pom.xml:
 
     <dependency>
-      <groupId>com.intel.chimera</groupId>
-      <artifactId>chimera</artifactId>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-crypto</artifactId>
       <version>0.9.0</version>
       <type>jar</type>
       <scope>compile</scope>
@@ -29,7 +29,7 @@ Add the following dependency to your pom.xml:
 ### Using with sbt
 
 ```
-libraryDependencies += "com.intel.chimera" % "chimera" % "0.9.0"
+libraryDependencies += "org.apache.commons" % "commons-crypto" % "0.9.0"
 ```
 
 ## Usage 
@@ -37,7 +37,7 @@ libraryDependencies += "com.intel.chimera" % "chimera" % "0.9.0"
 ```java
 
 Properties properties = new Properties();
-properties.setProperty("chimera.crypto.cipher.classes", "com.intel.chimera.crypto.OpensslCipher");
+properties.setProperty("chimera.crypto.cipher.classes", "org.apache.commons.crypto.cipher.OpensslCipher");
 
 Cipher cipher = Utils.getCipherInstance(CipherTransformation.AES_CTR_NOPADDING, properties);
 byte[] key = new byte[16];
@@ -61,15 +61,15 @@ int decryptedLen = cis.read(decryptedData, 0, 1024);
 ### Configuration
 Currently, two ciphers are supported: JceCipher and OpensslCipher, you can configure which cipher to use as follows:
 
-    $ java -Dchimera.crypto.cipher.classes=com.intel.chimera.crypto.OpensslCipher Sample
-    $ java -Dchimera.crypto.cipher.classes=com.intel.chimera.crypto.JceCipher Sample
+    $ java -Dchimera.crypto.cipher.classes=org.apache.commons.crypto.cipher.OpensslCipher Sample
+    $ java -Dchimera.crypto.cipher.classes=org.apache.commons.crypto.cipher.JceCipher Sample
 
 More detailed information about the configurations are as follows.
 
 | Property Name | Default | Meaning         |
 | --------------|---------|-------------------------|
 | chimera.crypto.cipher.transformation | AES/CTR/NoPadding | The value is identical to the transformations described in the Cipher section of the Java Cryptography Architecture Standard Algorithm Name Documentation. Currently only "AES/CTR/NoPadding" algorithm is supported.|
-| chimera.crypto.cipher.classes | com.intel.chimera.crypto.OpensslCipher, com.intel.chimera.crypto.JceCipher | Comma-separated list of cipher classes which implement cipher algorithm of "AES/CTR/NoPadding". A cipher implementation encapsulates the encryption and decryption details. The first  available implementation appearing in this list will be used. |
+| chimera.crypto.cipher.classes | org.apache.commons.crypto.cipher.OpensslCipher, org.apache.commons.crypto.cipher.JceCipher | Comma-separated list of cipher classes which implement cipher algorithm of "AES/CTR/NoPadding". A cipher implementation encapsulates the encryption and decryption details. The first  available implementation appearing in this list will be used. |
 
 ## Building from the source code
 Building from the source code is an option when your OS platform and CPU architecture is not supported. To build Chimera, you need JDK 1.7 or higher, OpenSSL 1.0.1c or higher, etc.

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 90c902a..03f52e4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,8 +17,8 @@
   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
                       http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <groupId>com.intel.chimera</groupId>
-  <artifactId>chimera</artifactId>
+  <groupId>org.apache.commons</groupId>
+  <artifactId>commons-crypto</artifactId>
   <packaging>jar</packaging>
   <description>chimera: A fast encryption/decryption library</description>
   <version>1.0.0-SNAPSHOT</version>
@@ -323,7 +323,7 @@
             <exclude>Makefile.common</exclude>
             <exclude>project/project/target/config-classes/*</exclude>
             <exclude>project/target/</exclude>
-            <exclude>src/main/java/com/intel/chimera/VERSION</exclude>
+            <exclude>src/main/java/org/apache/commons/crypto/VERSION</exclude>
           </excludes>
         </configuration>
       </plugin>

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/VERSION
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/VERSION b/src/main/java/com/intel/chimera/VERSION
deleted file mode 100644
index baca170..0000000
--- a/src/main/java/com/intel/chimera/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-VERSION=1.0.0-SNAPSHOT

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/Cipher.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/Cipher.java b/src/main/java/com/intel/chimera/cipher/Cipher.java
deleted file mode 100644
index ff1b118..0000000
--- a/src/main/java/com/intel/chimera/cipher/Cipher.java
+++ /dev/null
@@ -1,155 +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 com.intel.chimera.cipher;
-
-import java.io.Closeable;
-import java.nio.ByteBuffer;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.util.Properties;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.ShortBufferException;
-
-/**
- * The interface of cryptographic cipher for encryption and decryption.
- */
-public interface Cipher extends Closeable {
-
-  /**
-   * A constant representing encrypt mode.  The mode constant to be used
-   * when calling init method of the Cipher.
-   */
-  int ENCRYPT_MODE = 1;
-
-  /**
-   * A constant representing decrypt mode.  The mode constant to be used 
-   * when calling init method of the Cipher.
-   */
-  int DECRYPT_MODE = 0;
-
-  /**
-   * Gets the CipherTransformation for this cipher.
-   *
-   * @return the CipherTransformation for this cipher.
-   */
-  CipherTransformation getTransformation();
-
-  /**
-   * Gets the properties for this cipher.
-   * 
-   * @return the properties for this cipher.
-   */
-  Properties getProperties();
-
-  /**
-   * Initializes the cipher with mode, key and iv.
-   * 
-   * @param mode {@link #ENCRYPT_MODE} or {@link #DECRYPT_MODE}
-   * @param key crypto key for the cipher
-   * @param iv Initialization vector for the cipher
-   * @throws InvalidKeyException if the given key is inappropriate for
-   * initializing this cipher, or its keysize exceeds the maximum allowable
-   * keysize (as determined from the configured jurisdiction policy files).
-   * @throws InvalidAlgorithmParameterException if the given algorithm
-   * parameters are inappropriate for this cipher, or this cipher requires
-   * algorithm parameters and <code>params</code> is null, or the given
-   * algorithm parameters imply a cryptographic strength that would exceed
-   * the legal limits (as determined from the configured jurisdiction
-   * policy files).
-   */
-  void init(int mode, byte[] key, byte[] iv)
-      throws InvalidKeyException, InvalidAlgorithmParameterException;
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   * 
-   * @param inBuffer the input ByteBuffer
-   * @param outBuffer the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws ShortBufferException if there is insufficient space
-   * in the output buffer
-   */
-  int update(ByteBuffer inBuffer, ByteBuffer outBuffer)
-      throws ShortBufferException;
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   *
-   * @param input the input byte array
-   * @param inputOffset the offset in input where the input starts
-   * @param inputLen the input length
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if there is insufficient space in the output byte array
-   */
-  int update(byte[] input, int inputOffset, int inputLen,
-      byte[] output, int outputOffset)
-      throws ShortBufferException;
-
-  /**
-   * Encrypts or decrypts data in a single-part operation, or finishes a
-   * multiple-part operation.
-   * 
-   * @param inBuffer the input ByteBuffer
-   * @param outBuffer the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws BadPaddingException if this cipher is in decryption mode,
-   * and (un)padding has been requested, but the decrypted data is not
-   * bounded by the appropriate padding bytes
-   * @throws IllegalBlockSizeException if this cipher is a block cipher,
-   * no padding has been requested (only in encryption mode), and the total
-   * input length of the data processed by this cipher is not a multiple of
-   * block size; or if this encryption algorithm is unable to
-   * process the input data provided.
-   * @throws ShortBufferException if the given output buffer is too small
-   * to hold the result
-   */
-  int doFinal(ByteBuffer inBuffer, ByteBuffer outBuffer)
-      throws ShortBufferException, IllegalBlockSizeException,
-      BadPaddingException;
-
-  /**
-   * Encrypts or decrypts data in a single-part operation, or finishes a
-   * multiple-part operation.
-   *
-   * @param input the input byte array
-   * @param inputOffset the offset in input where the input starts
-   * @param inputLen the input length
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if the given output byte array is too small
-   * to hold the result
-   * @throws BadPaddingException if this cipher is in decryption mode,
-   * and (un)padding has been requested, but the decrypted data is not
-   * bounded by the appropriate padding bytes
-   * @throws IllegalBlockSizeException if this cipher is a block cipher,
-   * no padding has been requested (only in encryption mode), and the total
-   * input length of the data processed by this cipher is not a multiple of
-   * block size; or if this encryption algorithm is unable to
-   * process the input data provided.
-   */
-  int doFinal(byte[] input, int inputOffset, int inputLen,
-      byte[] output, int outputOffset)
-      throws ShortBufferException, IllegalBlockSizeException, BadPaddingException;
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/CipherFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/CipherFactory.java b/src/main/java/com/intel/chimera/cipher/CipherFactory.java
deleted file mode 100644
index f612830..0000000
--- a/src/main/java/com/intel/chimera/cipher/CipherFactory.java
+++ /dev/null
@@ -1,105 +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 com.intel.chimera.cipher;
-
-import java.security.GeneralSecurityException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import com.intel.chimera.utils.ReflectionUtils;
-import com.intel.chimera.utils.Utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is the factory class used for creating cipher class
- */
-public class CipherFactory {
-  
-  /** LOG instance for {@CipherFactory} */
-  public final static Logger LOG = LoggerFactory.getLogger(CipherFactory.class);
-
-  /**
-   * Gets a cipher instance for specified algorithm/mode/padding.
-   *
-   * @param props
-   *          the configuration properties
-   * @param transformation
-   *          algorithm/mode/padding
-   * @return Cipher the cipher. Null value will be returned if no
-   *         cipher classes with transformation configured.
-   */
-  public static Cipher getInstance(CipherTransformation transformation,
-      Properties props) throws GeneralSecurityException {
-    List<Class<? extends Cipher>> klasses = getCipherClasses(props);
-    Cipher cipher = null;
-    if (klasses != null) {
-      for (Class<? extends Cipher> klass : klasses) {
-        try {
-          cipher = ReflectionUtils.newInstance(klass, props, transformation);
-          if (cipher != null) {
-            LOG.debug("Using cipher {} for transformation {}.", klass.getName(),
-                transformation.getName());
-            break;
-          }
-        } catch (Exception e) {
-          LOG.error("Cipher {} is not available or transformation {} is not " +
-            "supported.", klass.getName(), transformation.getName());
-        }
-      }
-    }
-
-    return (cipher == null) ? new JceCipher(props, transformation) : cipher;
-  }
-
-  /**
-   * Gets a cipher for algorithm/mode/padding in config value
-   * chimera.crypto.cipher.transformation
-   *
-   * @return Cipher the cipher object Null value will be returned if no
-   *         cipher classes with transformation configured.
-   */
-  public static Cipher getInstance(CipherTransformation transformation)
-      throws GeneralSecurityException {
-    return getInstance(transformation, null);
-  }
-
-  private static List<Class<? extends Cipher>> getCipherClasses(Properties props) {
-    List<Class<? extends Cipher>> result = new ArrayList<Class<? extends
-        Cipher>>();
-    String cipherClassString = Utils.getCipherClassString(props);
-    if (cipherClassString == null) {
-      LOG.debug("No cipher classes configured.");
-      return null;
-    }
-    for (String c : Utils.splitClassNames(cipherClassString, ",")) {
-      try {
-        Class<?> cls = ReflectionUtils.getClassByName(c);
-        result.add(cls.asSubclass(Cipher.class));
-      } catch (ClassCastException e) {
-        LOG.error("Class {} is not a Cipher.", c);
-      } catch (ClassNotFoundException e) {
-        LOG.error("Cipher {} not found.", c);
-      }
-    }
-
-    return result;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/CipherTransformation.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/CipherTransformation.java b/src/main/java/com/intel/chimera/cipher/CipherTransformation.java
deleted file mode 100644
index 3714bbb..0000000
--- a/src/main/java/com/intel/chimera/cipher/CipherTransformation.java
+++ /dev/null
@@ -1,96 +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 com.intel.chimera.cipher;
-
-/**
- * Defines properties of a CipherTransformation. Modeled after the ciphers in
- * {@link javax.crypto.Cipher}.
- */
-public enum CipherTransformation {
-
-  /** A crypto transformation representing AES/CTR/NoPadding */
-  AES_CTR_NOPADDING("AES/CTR/NoPadding", 16),
-  /** A crypto transformation representing AES/CBC/NoPadding */
-  AES_CBC_NOPADDING("AES/CBC/NoPadding", 16),
-  /** A crypto transformation representing AES/CBC/PKCS5Padding */
-  AES_CBC_PKCS5PADDING("AES/CBC/PKCS5Padding", 16);
-
-  private final String name;
-  private final int algorithmBlockSize;
-
-  /**
-   * Constructor for CipherTransformation.  Initalizes the cipher with algorithm
-   * name and block size of the algorithm.
-   *
-   * @param name the name of cipher algorithm
-   * @param algorithmBlockSize the blockSize of cipher algorithm
-   */
-  CipherTransformation(String name, int algorithmBlockSize) {
-    this.name = name;
-    this.algorithmBlockSize = algorithmBlockSize;
-  }
-
-  /**
-   * Gets the algorithm name of cipher.
-   *
-   * @return name of cipher transformation, as in {@link javax.crypto.Cipher}
-   */
-  public String getName() {
-    return name;
-  }
-
-  /**
-   * Gets the algorithm block size of cipher.
-   *
-   * @return size of an algorithm block in bytes.
-   */
-  public int getAlgorithmBlockSize() {
-    return algorithmBlockSize;
-  }
-
-  /**
-   * Overrides {@link java.lang.Enum#toString()}
-   *
-   * @return the name of cipher algorithm and blocksize.
-   */
-  @Override
-  public String toString() {
-    StringBuilder builder = new StringBuilder("{");
-    builder.append("name: " + name);
-    builder.append(", algorithmBlockSize: " + algorithmBlockSize);
-    builder.append("}");
-    return builder.toString();
-  }
-
-  /**
-   * Converts to CipherTransformation from name, {@link #algorithmBlockSize} 
-   * is fixed for certain cipher transformation, just need to compare the name.
-   *
-   * @param name cipher transformation name
-   * @return CipherTransformation cipher transformation
-   */
-  public static CipherTransformation fromName(String name) {
-    CipherTransformation[] transformations = CipherTransformation.values();
-    for (CipherTransformation transformation : transformations) {
-      if (transformation.getName().equals(name)) {
-        return transformation;
-      }
-    }
-    throw new IllegalArgumentException("Invalid transformation name: " + name);
-  }
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/JceCipher.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/JceCipher.java b/src/main/java/com/intel/chimera/cipher/JceCipher.java
deleted file mode 100644
index a46ecd8..0000000
--- a/src/main/java/com/intel/chimera/cipher/JceCipher.java
+++ /dev/null
@@ -1,207 +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 com.intel.chimera.cipher;
-
-import java.nio.ByteBuffer;
-import java.security.GeneralSecurityException;
-import java.security.InvalidAlgorithmParameterException;
-import java.security.InvalidKeyException;
-import java.util.Properties;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.ShortBufferException;
-import javax.crypto.spec.IvParameterSpec;
-import javax.crypto.spec.SecretKeySpec;
-
-import com.intel.chimera.utils.Utils;
-
-/**
- * Implements the {@link com.intel.chimera.cipher.Cipher} using JCE provider.
- */
-public class JceCipher implements Cipher {
-  private final Properties props;
-  private final CipherTransformation transformation;
-  private final javax.crypto.Cipher cipher;
-
-  /**
-   * Constructs a {@link com.intel.chimera.cipher.Cipher} based on JCE
-   * Cipher {@link javax.crypto.Cipher}.
-   * @param props properties for JCE cipher
-   * @param transformation transformation for JCE cipher
-   * @throws GeneralSecurityException if JCE cipher initialize failed
-   */
-  public JceCipher(Properties props, CipherTransformation transformation)
-      throws GeneralSecurityException {
-    this.props = props;
-    this.transformation = transformation;
-
-    String provider = Utils.getJCEProvider(props);
-    if (provider == null || provider.isEmpty()) {
-      cipher = javax.crypto.Cipher.getInstance(transformation.getName());
-    } else {
-      cipher = javax.crypto.Cipher.getInstance(transformation.getName(), provider);
-    }
-  }
-
-  /**
-   * Gets the CipherTransformation for the jce cipher.
-   *
-   * @return the CipherTransformation for this cipher
-   */
-  @Override
-  public CipherTransformation getTransformation() {
-    return transformation;
-  }
-
-  /**
-   * Gets the properties for the jce cipher.
-   *
-   * @return the properties for this cipher.
-   */
-  @Override
-  public Properties getProperties() {
-    return props;
-  }
-
-  /**
-   * Initializes the cipher with mode, key and iv.
-   * 
-   * @param mode {@link #ENCRYPT_MODE} or {@link #DECRYPT_MODE}
-   * @param key crypto key for the cipher
-   * @param iv Initialization vector for the cipher
-   * @throws InvalidAlgorithmParameterException if the given algorithm
-   * parameters are inappropriate for this cipher, or this cipher requires
-   * algorithm parameters and <code>params</code> is null, or the given
-   * algorithm parameters imply a cryptographic strength that would exceed
-   * the legal limits (as determined from the configured jurisdiction
-   * policy files).
-   */
-  @Override
-  public void init(int mode, byte[] key, byte[] iv)
-      throws InvalidKeyException, InvalidAlgorithmParameterException {
-    Utils.checkNotNull(key);
-    Utils.checkNotNull(iv);
-
-    int cipherMode = javax.crypto.Cipher.DECRYPT_MODE;
-    if (mode == ENCRYPT_MODE)
-      cipherMode = javax.crypto.Cipher.ENCRYPT_MODE;
-
-    cipher.init(cipherMode, new SecretKeySpec(key, "AES"),
-        new IvParameterSpec(iv));
-  }
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   * 
-   * @param inBuffer the input ByteBuffer
-   * @param outBuffer the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws ShortBufferException if there is insufficient space
-   * in the output buffer
-   */
-  @Override
-  public int update(ByteBuffer inBuffer, ByteBuffer outBuffer)
-      throws ShortBufferException {
-    return cipher.update(inBuffer, outBuffer);
-  }
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   *
-   * @param input the input byte array
-   * @param inputOffset the offset in input where the input starts
-   * @param inputLen the input length
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if there is insufficient space in the output byte array
-   */
-  @Override
-  public int update(byte[] input, int inputOffset, int inputLen,
-      byte[] output, int outputOffset)
-      throws ShortBufferException {
-    return cipher.update(input, inputOffset, inputLen,
-                         output, outputOffset);
-  }
-
-  /**
-   * Encrypts or decrypts data in a single-part operation, or finishes a
-   * multiple-part operation. The data is encrypted or decrypted, depending
-   * on how this cipher was initialized.
-   *
-   * @param inBuffer the input ByteBuffer
-   * @param outBuffer the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws BadPaddingException if this cipher is in decryption mode,
-   * and (un)padding has been requested, but the decrypted data is not
-   * bounded by the appropriate padding bytes
-   * @throws IllegalBlockSizeException if this cipher is a block cipher,
-   * no padding has been requested (only in encryption mode), and the total
-   * input length of the data processed by this cipher is not a multiple of
-   * block size; or if this encryption algorithm is unable to
-   * process the input data provided.
-   * @throws ShortBufferException if the given output buffer is too small
-   * to hold the result
-   */
-  @Override
-  public int doFinal(ByteBuffer inBuffer, ByteBuffer outBuffer)
-      throws ShortBufferException, IllegalBlockSizeException,
-      BadPaddingException {
-    return cipher.doFinal(inBuffer, outBuffer);
-  }
-
-  /**
-   * Encrypts or decrypts data in a single-part operation, or finishes a
-   * multiple-part operation.
-   *
-   * @param input the input byte array
-   * @param inputOffset the offset in input where the input starts
-   * @param inputLen the input length
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if the given output byte array is too small
-   * to hold the result
-   * @throws BadPaddingException if this cipher is in decryption mode,
-   * and (un)padding has been requested, but the decrypted data is not
-   * bounded by the appropriate padding bytes
-   * @throws IllegalBlockSizeException if this cipher is a block cipher,
-   * no padding has been requested (only in encryption mode), and the total
-   * input length of the data processed by this cipher is not a multiple of
-   * block size; or if this encryption algorithm is unable to
-   * process the input data provided.
-   */
-  @Override
-  public int doFinal(byte[] input, int inputOffset, int inputLen,
-      byte[] output, int outputOffset)
-      throws ShortBufferException, IllegalBlockSizeException, BadPaddingException {
-    return cipher.doFinal(input, inputOffset, inputLen,
-                          output, outputOffset);
-  }
-
-  /**
-   * Closes Jce cipher.
-   */
-  @Override
-  public void close() {
-    // Do nothing
-  }
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/Openssl.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/Openssl.java b/src/main/java/com/intel/chimera/cipher/Openssl.java
deleted file mode 100644
index 8025ceb..0000000
--- a/src/main/java/com/intel/chimera/cipher/Openssl.java
+++ /dev/null
@@ -1,320 +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 com.intel.chimera.cipher;
-
-import java.nio.ByteBuffer;
-import java.security.NoSuchAlgorithmException;
-import java.util.StringTokenizer;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.ShortBufferException;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.intel.chimera.utils.NativeCodeLoader;
-import com.intel.chimera.utils.Utils;
-
-/**
- * OpenSSL cryptographic wrapper using JNI.
- * Currently only AES-CTR is supported. It's flexible to add
- * other crypto algorithms/modes.
- */
-public final class Openssl {
-  private static final Log LOG = LogFactory.getLog(Openssl.class.getName());
-
-  // Mode constant defined by Openssl JNI
-  public static final int ENCRYPT_MODE = 1;
-  public static final int DECRYPT_MODE = 0;
-
-  /** Currently only support AES/CTR/NoPadding. */
-  private static enum AlgorithmMode {
-    AES_CTR,
-    AES_CBC;
-
-    static int get(String algorithm, String mode)
-        throws NoSuchAlgorithmException {
-      try {
-        return AlgorithmMode.valueOf(algorithm + "_" + mode).ordinal();
-      } catch (Exception e) {
-        throw new NoSuchAlgorithmException("Doesn't support algorithm: " +
-            algorithm + " and mode: " + mode);
-      }
-    }
-  }
-
-  private static enum Padding {
-    NoPadding,
-    PKCS5Padding;
-
-    static int get(String padding) throws NoSuchPaddingException {
-      try {
-        return Padding.valueOf(padding).ordinal();
-      } catch (Exception e) {
-        throw new NoSuchPaddingException("Doesn't support padding: " + padding);
-      }
-    }
-  }
-
-  private long context = 0;
-  private final int algorithm;
-  private final int padding;
-
-  private static final String loadingFailureReason;
-
-  static {
-    String loadingFailure = null;
-    try {
-      if (NativeCodeLoader.isNativeCodeLoaded()) {
-        OpensslNative.initIDs();
-      }
-    } catch (Throwable t) {
-      loadingFailure = t.getMessage();
-      LOG.debug("Failed to load OpenSSL Cipher.", t);
-    } finally {
-      loadingFailureReason = loadingFailure;
-    }
-  }
-
-  /**
-   * Gets the failure reason when loading Openssl native.
-   * @return the failure reason.
-   */
-  public static String getLoadingFailureReason() {
-    return loadingFailureReason;
-  }
-
-  private Openssl(long context, int algorithm, int padding) {
-    this.context = context;
-    this.algorithm = algorithm;
-    this.padding = padding;
-  }
-
-  /**
-   * Return an <code>OpensslCipher<code> object that implements the specified
-   * transformation.
-   *
-   * @param transformation the name of the transformation, e.g.,
-   * AES/CTR/NoPadding.
-   * @return OpensslCipher an <code>OpensslCipher<code> object
-   * @throws NoSuchAlgorithmException if <code>transformation</code> is null,
-   * empty, in an invalid format, or if Openssl doesn't implement the
-   * specified algorithm.
-   * @throws NoSuchPaddingException if <code>transformation</code> contains
-   * a padding scheme that is not available.
-   */
-  public static final Openssl getInstance(String transformation)
-      throws NoSuchAlgorithmException, NoSuchPaddingException {
-    Transform transform = tokenizeTransformation(transformation);
-    int algorithmMode = AlgorithmMode.get(transform.algorithm, transform.mode);
-    int padding = Padding.get(transform.padding);
-    long context = OpensslNative.initContext(algorithmMode, padding);
-    return new Openssl(context, algorithmMode, padding);
-  }
-
-  /** Nested class for algorithm, mode and padding. */
-  private static class Transform {
-    final String algorithm;
-    final String mode;
-    final String padding;
-
-    public Transform(String algorithm, String mode, String padding) {
-      this.algorithm = algorithm;
-      this.mode = mode;
-      this.padding = padding;
-    }
-  }
-
-  private static Transform tokenizeTransformation(String transformation)
-      throws NoSuchAlgorithmException {
-    if (transformation == null) {
-      throw new NoSuchAlgorithmException("No transformation given.");
-    }
-
-    /*
-     * Array containing the components of a Cipher transformation:
-     *
-     * index 0: algorithm (e.g., AES)
-     * index 1: mode (e.g., CTR)
-     * index 2: padding (e.g., NoPadding)
-     */
-    String[] parts = new String[3];
-    int count = 0;
-    StringTokenizer parser = new StringTokenizer(transformation, "/");
-    while (parser.hasMoreTokens() && count < 3) {
-      parts[count++] = parser.nextToken().trim();
-    }
-    if (count != 3 || parser.hasMoreTokens()) {
-      throw new NoSuchAlgorithmException("Invalid transformation format: " +
-          transformation);
-    }
-    return new Transform(parts[0], parts[1], parts[2]);
-  }
-
-  /**
-   * Initialize this cipher with a key and IV.
-   *
-   * @param mode {@link #ENCRYPT_MODE} or {@link #DECRYPT_MODE}
-   * @param key crypto key
-   * @param iv crypto iv
-   */
-  public void init(int mode, byte[] key, byte[] iv) {
-    context = OpensslNative.init(context, mode, algorithm, padding, key, iv);
-  }
-
-  /**
-   * Continues a multiple-part encryption or decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   * <p/>
-   *
-   * All <code>input.remaining()</code> bytes starting at
-   * <code>input.position()</code> are processed. The result is stored in
-   * the output buffer.
-   * <p/>
-   *
-   * Upon return, the input buffer's position will be equal to its limit;
-   * its limit will not have changed. The output buffer's position will have
-   * advanced by n, when n is the value returned by this method; the output
-   * buffer's limit will not have changed.
-   * <p/>
-   *
-   * If <code>output.remaining()</code> bytes are insufficient to hold the
-   * result, a <code>ShortBufferException</code> is thrown.
-   *
-   * @param input the input ByteBuffer
-   * @param output the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws ShortBufferException if there is insufficient space in the
-   * output buffer
-   */
-  public int update(ByteBuffer input, ByteBuffer output)
-      throws ShortBufferException {
-    checkState();
-    Utils.checkArgument(input.isDirect() && output.isDirect(),
-        "Direct buffers are required.");
-    int len = OpensslNative.update(context, input, input.position(),
-        input.remaining(), output, output.position(), output.remaining());
-    input.position(input.limit());
-    output.position(output.position() + len);
-    return len;
-  }
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   *
-   * @param input the input byte array
-   * @param inputOffset the offset in input where the input starts
-   * @param inputLen the input length
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if there is insufficient space in the output byte array
-   */
-  public int update(byte[] input, int inputOffset, int inputLen,
-      byte[] output, int outputOffset)
-      throws ShortBufferException {
-    checkState();
-    return OpensslNative.updateByteArray(context, input, inputOffset, inputLen,
-        output, outputOffset, output.length - outputOffset);
-  }
-
-  /**
-   * Finishes a multiple-part operation. The data is encrypted or decrypted,
-   * depending on how this cipher was initialized.
-   * <p/>
-   *
-   * The result is stored in the output buffer. Upon return, the output buffer's
-   * position will have advanced by n, where n is the value returned by this
-   * method; the output buffer's limit will not have changed.
-   * <p/>
-   *
-   * If <code>output.remaining()</code> bytes are insufficient to hold the result,
-   * a <code>ShortBufferException</code> is thrown.
-   * <p/>
-   *
-   * Upon finishing, this method resets this cipher object to the state it was
-   * in when previously initialized. That is, the object is available to encrypt
-   * or decrypt more data.
-   * <p/>
-   *
-   * If any exception is thrown, this cipher object need to be reset before it
-   * can be used again.
-   *
-   * @param output the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws ShortBufferException
-   * @throws IllegalBlockSizeException
-   * @throws BadPaddingException
-   */
-  public int doFinal(ByteBuffer output)
-      throws ShortBufferException, IllegalBlockSizeException,
-      BadPaddingException {
-    checkState();
-    Utils.checkArgument(output.isDirect(), "Direct buffer is required.");
-    int len = OpensslNative.doFinal(context, output, output.position(), output.remaining());
-    output.position(output.position() + len);
-    return len;
-  }
-
-  /**
-   * Encrypts or decrypts data in a single-part operation, or finishes a
-   * multiple-part operation.
-   *
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if the given output byte array is too small
-   * to hold the result
-   * @throws BadPaddingException if this cipher is in decryption mode,
-   * and (un)padding has been requested, but the decrypted data is not
-   * bounded by the appropriate padding bytes
-   * @throws IllegalBlockSizeException if this cipher is a block cipher,
-   * no padding has been requested (only in encryption mode), and the total
-   * input length of the data processed by this cipher is not a multiple of
-   * block size; or if this encryption algorithm is unable to
-   * process the input data provided.
-   */
-  public int doFinal(byte[] output, int outputOffset)
-      throws ShortBufferException, IllegalBlockSizeException, BadPaddingException {
-    checkState();
-    return OpensslNative.doFinalByteArray(context,
-        output, outputOffset, output.length - outputOffset);
-  }
-
-  /** Forcibly clean the context. */
-  public void clean() {
-    if (context != 0) {
-      OpensslNative.clean(context);
-      context = 0;
-    }
-  }
-
-  /** Checks whether context is initialized. */
-  private void checkState() {
-    Utils.checkState(context != 0);
-  }
-
-  @Override
-  protected void finalize() throws Throwable {
-    clean();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/OpensslCipher.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/OpensslCipher.java b/src/main/java/com/intel/chimera/cipher/OpensslCipher.java
deleted file mode 100644
index 6e39c84..0000000
--- a/src/main/java/com/intel/chimera/cipher/OpensslCipher.java
+++ /dev/null
@@ -1,196 +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 com.intel.chimera.cipher;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.security.GeneralSecurityException;
-import java.util.Properties;
-
-import javax.crypto.BadPaddingException;
-import javax.crypto.IllegalBlockSizeException;
-import javax.crypto.ShortBufferException;
-
-import com.intel.chimera.utils.Utils;
-
-/**
- * Implements the Cipher using JNI into OpenSSL.
- */
-public class OpensslCipher implements Cipher {
-  private final Properties props;
-  private final CipherTransformation transformation;
-  private final Openssl cipher;
-
-  /**
-   * Constructs a {@link com.intel.chimera.cipher.Cipher} using JNI into OpenSSL
-   * 
-   * @param props properties for OpenSSL cipher
-   * @param transformation transformation for OpenSSL cipher
-   * @throws GeneralSecurityException if OpenSSL cipher initialize failed
-   */
-  public OpensslCipher(Properties props, CipherTransformation transformation)
-      throws GeneralSecurityException {
-    this.props = props;
-    this.transformation = transformation;
-
-    String loadingFailureReason = Openssl.getLoadingFailureReason();
-    if (loadingFailureReason != null) {
-      throw new RuntimeException(loadingFailureReason);
-    }
-
-    cipher = Openssl.getInstance(transformation.getName());
-  }
-
-  /**
-   * Gets the CipherTransformation for the openssl cipher.
-   *
-   * @return the CipherTransformation for this cipher
-   */
-  @Override
-  public CipherTransformation getTransformation() {
-    return transformation;
-  }
-
-  /**
-   * Gets the properties for the openssl cipher.
-   *
-   * @return the properties for this cipher.
-   */
-  @Override
-  public Properties getProperties() {
-    return props;
-  }
-
-  /**
-   * Initializes the cipher with mode, key and iv.
-   * @param mode {@link #ENCRYPT_MODE} or {@link #DECRYPT_MODE}
-   * @param key crypto key for the cipher
-   * @param iv Initialization vector for the cipher
-   * @throws IOException if cipher initialize fails
-   */
-  @Override
-  public void init(int mode, byte[] key, byte[] iv) {
-    Utils.checkNotNull(key);
-    Utils.checkNotNull(iv);
-
-    int cipherMode = Openssl.DECRYPT_MODE;
-    if (mode == ENCRYPT_MODE)
-      cipherMode = Openssl.ENCRYPT_MODE;
-
-    cipher.init(cipherMode, key, iv);
-  }
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   * @param inBuffer the input ByteBuffer
-   * @param outBuffer the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws ShortBufferException if there is insufficient space
-   * in the output buffer
-   */
-  @Override
-  public int update(ByteBuffer inBuffer, ByteBuffer outBuffer)
-      throws ShortBufferException {
-    return cipher.update(inBuffer, outBuffer);
-  }
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   *
-   * @param input the input byte array
-   * @param inputOffset the offset in input where the input starts
-   * @param inputLen the input length
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if there is insufficient space in the output byte array
-   */
-  @Override
-  public int update(byte[] input, int inputOffset, int inputLen,
-      byte[] output, int outputOffset)
-      throws ShortBufferException {
-    return cipher.update(input, inputOffset, inputLen,
-                         output, outputOffset);
-  }
-
-  /**
-   * Encrypts or decrypts data in a single-part operation, or finishes a
-   * multiple-part operation. The data is encrypted or decrypted, depending
-   * on how this cipher was initialized.
-   * @param inBuffer the input ByteBuffer
-   * @param outBuffer the output ByteBuffer
-   * @return int number of bytes stored in <code>output</code>
-   * @throws BadPaddingException if this cipher is in decryption mode,
-   * and (un)padding has been requested, but the decrypted data is not
-   * bounded by the appropriate padding bytes
-   * @throws IllegalBlockSizeException if this cipher is a block cipher,
-   * no padding has been requested (only in encryption mode), and the total
-   * input length of the data processed by this cipher is not a multiple of
-   * block size; or if this encryption algorithm is unable to
-   * process the input data provided.
-   * @throws ShortBufferException if the given output buffer is too small
-   * to hold the result
-   */
-  @Override
-  public int doFinal(ByteBuffer inBuffer, ByteBuffer outBuffer)
-      throws ShortBufferException, IllegalBlockSizeException,
-      BadPaddingException {
-    int n = cipher.update(inBuffer, outBuffer);
-    return n + cipher.doFinal(outBuffer);
-  }
-
-  /**
-   * Encrypts or decrypts data in a single-part operation, or finishes a
-   * multiple-part operation.
-   *
-   * @param input the input byte array
-   * @param inputOffset the offset in input where the input starts
-   * @param inputLen the input length
-   * @param output the byte array for the result
-   * @param outputOffset the offset in output where the result is stored
-   * @return the number of bytes stored in output
-   * @throws ShortBufferException if the given output byte array is too small
-   * to hold the result
-   * @throws BadPaddingException if this cipher is in decryption mode,
-   * and (un)padding has been requested, but the decrypted data is not
-   * bounded by the appropriate padding bytes
-   * @throws IllegalBlockSizeException if this cipher is a block cipher,
-   * no padding has been requested (only in encryption mode), and the total
-   * input length of the data processed by this cipher is not a multiple of
-   * block size; or if this encryption algorithm is unable to
-   * process the input data provided.
-   */
-  @Override
-  public int doFinal(byte[] input, int inputOffset, int inputLen,
-      byte[] output, int outputOffset)
-      throws ShortBufferException, IllegalBlockSizeException, BadPaddingException {
-    int n = cipher.update(input, inputOffset, inputLen,
-                          output, outputOffset);
-    return n + cipher.doFinal(output, outputOffset + n);
-  }
-
-  /**
-   * Closes the OpenSSL cipher. Clean the Openssl native context.
-   */
-  @Override
-  public void close() {
-    cipher.clean();
-  }
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/OpensslNative.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/OpensslNative.java b/src/main/java/com/intel/chimera/cipher/OpensslNative.java
deleted file mode 100644
index ed209e8..0000000
--- a/src/main/java/com/intel/chimera/cipher/OpensslNative.java
+++ /dev/null
@@ -1,116 +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 com.intel.chimera.cipher;
-
-import java.nio.ByteBuffer;
-
-/**
- * JNI interface of {@link Openssl} implementation. The native method in this class is
- * defined in OpensslNative.h(genereted by javah).
- */
-public class OpensslNative {
-
-  /**
-   * Declares a native method to initialize JNI field and method IDs.
-   */
-  public native static void initIDs();
-
-  /**
-   * Declares a native method to initialize the cipher context.
-   *
-   * @param algorithm The algorithm name of cipher
-   * @param padding The padding name of cipher
-   * @return the context address of cipher
-   */
-  public native static long initContext(int algorithm, int padding);
-
-  /**
-   * Declares a native method to initialize the cipher context.
-   *
-   * @return the context address of cipher
-   */
-  public native static long init(long context, int mode, int alg, int padding,
-      byte[] key, byte[] iv);
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   *
-   * @param context The cipher context address
-   * @param input The input byte buffer
-   * @param inputOffset The offset in input where the input starts
-   * @param inputLength The input length
-   * @param output The byte buffer for the result
-   * @param outputOffset The offset in output where the result is stored
-   * @param maxOutputLength The maximum length for output
-   * @return The number of bytes stored in output
-   */
-  public native static int update(long context, ByteBuffer input,
-      int inputOffset, int inputLength, ByteBuffer output, int outputOffset,
-      int maxOutputLength);
-
-  /**
-   * Continues a multiple-part encryption/decryption operation. The data
-   * is encrypted or decrypted, depending on how this cipher was initialized.
-   *
-   * @param context The cipher context address
-   * @param input The input byte array
-   * @param inputOffset  The offset in input where the input starts
-   * @param inputLength The input length
-   * @param output The byte array for the result
-   * @param outputOffset The offset in output where the result is stored
-   * @param maxOutputLength The maximum length for output
-   * @return The number of bytes stored in output
-   */
-  public native static int updateByteArray(long context, byte[] input,
-      int inputOffset, int inputLength, byte[] output, int outputOffset,
-      int maxOutputLength);
-
-  /**
-   * Finishes a multiple-part operation. The data is encrypted or decrypted,
-   * depending on how this cipher was initialized.
-   *
-   * @param context The cipher context address
-   * @param output The byte buffer for the result
-   * @param offset The offset in output where the result is stored
-   * @param maxOutputLength The maximum length for output
-   * @return The number of bytes stored in output
-   */
-  public native static int doFinal(long context, ByteBuffer output, int offset,
-      int maxOutputLength);
-
-  /**
-   * Finishes a multiple-part operation. The data is encrypted or decrypted,
-   * depending on how this cipher was initialized.
-   *
-   * @param context The cipher context address
-   * @param output The byte array for the result
-   * @param offset The offset in output where the result is stored
-   * @param maxOutputLength The maximum length for output
-   * @return The number of bytes stored in output
-   */
-  public native static int doFinalByteArray(long context, byte[] output, int offset,
-      int maxOutputLength);
-
-  /**
-   * Cleans the context at native.
-   *
-   * @param context The cipher context address
-   */
-  public native static void clean(long context);
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/cipher/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/cipher/package-info.java b/src/main/java/com/intel/chimera/cipher/package-info.java
deleted file mode 100644
index 80a2c8f..0000000
--- a/src/main/java/com/intel/chimera/cipher/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-
-/**
- * Cipher classes
- */
-package com.intel.chimera.cipher;

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/conf/ConfigurationKeys.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/conf/ConfigurationKeys.java b/src/main/java/com/intel/chimera/conf/ConfigurationKeys.java
deleted file mode 100644
index 4058636..0000000
--- a/src/main/java/com/intel/chimera/conf/ConfigurationKeys.java
+++ /dev/null
@@ -1,139 +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 com.intel.chimera.conf;
-
-import com.intel.chimera.cipher.JceCipher;
-
-/**
- * The ConfigurationKeys contains Configuration keys and default values.
- */
-public class ConfigurationKeys {
-
-  /**
-   * The prefix named with project name.
-   */
-  public static final String CHIMERA_PREFIX = "chimera.";
-
-  /**
-   * The filename of configuration file.
-   */
-  public static final String CHIMERA_SYSTEM_PROPERTIES_FILE =
-      CHIMERA_PREFIX + "properties";
-
-  /**
-   * The prefix of crypto configuration.
-   */
-  public static final String CONF_PREFIX =
-      CHIMERA_PREFIX + "crypto.";
-
-  /**
-   * The configuration key of implementation class for crypto cipher.
-   * The values of CHIMERA_CRYPTO_CIPHER_CLASSES_KEY can be
-   * "com.intel.chimera.cipher.JceCipher" and "com.intel.chimera.cipher.OpensslCipher".
-   * And it takes a common separated list.
-   * The "com.intel.chimera.cipher.JceCipher" use jce provider to
-   * implement {@link com.intel.chimera.cipher.Cipher} and
-   * the "com.intel.chimera.cipher.OpensslCipher" use jni into openssl to implement.
-   * Note that for each value,the first value which can be created without exception
-   * will be used (priority by order).
-    */
-  public static final String CHIMERA_CRYPTO_CIPHER_CLASSES_KEY =
-      CONF_PREFIX + "cipher.classes";
-
-  /**
-   * The default value for crypto cipher.
-   */
-  public static final String CHIMERA_CRYPTO_CIPHER_CLASSES_DEFAULT =
-      JceCipher.class.getName();
-
-  /**
-   * The configuration key of the provider class for JCE cipher.
-   */
-  public static final String CHIMERA_CRYPTO_CIPHER_JCE_PROVIDER_KEY =
-      CONF_PREFIX + "cipher.jce.provider";
-
-  // security random related configuration keys
-  /**
-   * The configuration key of the file path for secure random device.
-   */
-  public static final String CHIMERA_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_KEY =
-      CONF_PREFIX + "secure.random.device.file.path";
-
-  /**
-   * The default value of the file path for secure random device.
-   */
-  public static final String CHIMERA_CRYPTO_SECURE_RANDOM_DEVICE_FILE_PATH_DEFAULT =
-      "/dev/urandom";
-
-  /**
-   * The configuration key of the algorithm of secure random.
-   */
-  public static final String CHIMERA_CRYPTO_SECURE_RANDOM_JAVA_ALGORITHM_KEY =
-      CONF_PREFIX + "secure.random.java.algorithm";
-
-  /**
-   * The default value of the algorithm of secure random.
-   */
-  public static final String
-      CHIMERA_CRYPTO_SECURE_RANDOM_JAVA_ALGORITHM_DEFAULT = "SHA1PRNG";
-
-  /**
-   * The configuration key of the implementation class for secure random.
-   * The values of CHIMERA_CRYPTO_SECURE_RANDOM_CLASSES_KEY can be
-   * "com.intel.chimera.random.JavaSecureRandom" and "com.intel.chimera.random.OpensslSecureRandom".
-   * And it takes a common separated list.
-   * The "com.intel.chimera.random.JavaSecureRandom" use java to
-   * implement {@link com.intel.chimera.random.SecureRandom} and
-   * the "com.intel.chimera.random.OpensslSecureRandom" use jni into openssl to implement.
-   * Note that for each value,the first value which can be created without exception
-   * will be used (priority by order).
-   */
-  public static final String CHIMERA_CRYPTO_SECURE_RANDOM_CLASSES_KEY =
-      CONF_PREFIX + "secure.random.classes";
-
-  /**
-   * The configuration key of the buffer size for stream.
-   */
-  public static final String CHIMERA_CRYPTO_STREAM_BUFFER_SIZE_KEY =
-      CONF_PREFIX + "stream.buffer.size";
-
-  // stream related configuration keys
-  /**
-   * The default value of the buffer size for stream.
-   */
-  public static final int CHIMERA_CRYPTO_STREAM_BUFFER_SIZE_DEFAULT = 8192;
-
-  // native lib related configuration keys
-  /**
-   * The configuration key of the path for loading crypto library.
-   */
-  public static final String CHIMERA_CRYPTO_LIB_PATH_KEY =
-      CONF_PREFIX + "lib.path";
-
-  /**
-   * The configuration key of the file name for loading crypto library.
-   */
-  public static final String CHIMERA_CRYPTO_LIB_NAME_KEY =
-      CONF_PREFIX + "lib.name";
-
-  /**
-   * The configuration key of temp directory for extracting crypto library.
-   */
-  public static final String CHIMERA_CRYPTO_LIB_TEMPDIR_KEY =
-      CONF_PREFIX + "lib.tempdir";
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/conf/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/conf/package-info.java b/src/main/java/com/intel/chimera/conf/package-info.java
deleted file mode 100644
index d9cd2b8..0000000
--- a/src/main/java/com/intel/chimera/conf/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-/**
- * Configuration classes
- */
-package com.intel.chimera.conf;

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/random/JavaSecureRandom.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/random/JavaSecureRandom.java b/src/main/java/com/intel/chimera/random/JavaSecureRandom.java
deleted file mode 100644
index ec4063d..0000000
--- a/src/main/java/com/intel/chimera/random/JavaSecureRandom.java
+++ /dev/null
@@ -1,73 +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 com.intel.chimera.random;
-
-import java.security.NoSuchAlgorithmException;
-import java.util.Properties;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.intel.chimera.conf.ConfigurationKeys;
-
-/**
- * A SecureRandom of Java implementation.
- */
-public class JavaSecureRandom implements SecureRandom {
-  private static final Log LOG =
-      LogFactory.getLog(JavaSecureRandom.class.getName());
-
-  private java.security.SecureRandom instance;
-
-  /**
-   * Constructs a {@link com.intel.chimera.random.JavaSecureRandom}.
-   *
-   * @param properties the configuration properties.
-   */
-  public JavaSecureRandom(Properties properties) {
-    try {
-      instance = java.security.SecureRandom
-          .getInstance(properties.getProperty(
-              ConfigurationKeys.CHIMERA_CRYPTO_SECURE_RANDOM_JAVA_ALGORITHM_KEY,
-              ConfigurationKeys.CHIMERA_CRYPTO_SECURE_RANDOM_JAVA_ALGORITHM_DEFAULT));
-    } catch (NoSuchAlgorithmException e) {
-      LOG.error("Failed to create java secure random due to error: " + e);
-    }
-  }
-
-  /**
-   * Overrides {@link java.lang.AutoCloseable#close()}.
-   * For{@link JavaSecureRandom}, we don't need to recycle resource.
-   */
-  @Override
-  public void close() {
-    // do nothing
-  }
-
-  /**
-   * Overrides {@link com.intel.chimera.random.SecureRandom#nextBytes(byte[])}.
-   * Generates random bytes and places them into a user-supplied byte array.
-   * The number of random bytes produced is equal to the length of the byte array.
-   *
-   * @param bytes the array to be filled in with random bytes.
-   */
-  @Override
-  public void nextBytes(byte[] bytes) {
-    instance.nextBytes(bytes);
-  }
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/random/OpensslSecureRandom.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/random/OpensslSecureRandom.java b/src/main/java/com/intel/chimera/random/OpensslSecureRandom.java
deleted file mode 100644
index bbf0f86..0000000
--- a/src/main/java/com/intel/chimera/random/OpensslSecureRandom.java
+++ /dev/null
@@ -1,140 +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 com.intel.chimera.random;
-
-import java.util.Properties;
-import java.util.Random;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.intel.chimera.utils.NativeCodeLoader;
-import com.intel.chimera.utils.Utils;
-
-/**
- * OpenSSL secure random using JNI.
- * This implementation is thread-safe.
- * <p/>
- *
- * If using an Intel chipset with RDRAND, the high-performance hardware
- * random number generator will be used and it's much faster than
- * {@link java.security.SecureRandom}. If RDRAND is unavailable, default
- * OpenSSL secure random generator will be used. It's still faster
- * and can generate strong random bytes.
- * <p/>
- * @see https://wiki.openssl.org/index.php/Random_Numbers
- * @see http://en.wikipedia.org/wiki/RdRand
- */
-public class OpensslSecureRandom extends Random implements SecureRandom {
-  private static final long serialVersionUID = -7828193502768789584L;
-  private static final Log LOG =
-      LogFactory.getLog(OpensslSecureRandom.class.getName());
-
-  /** If native SecureRandom unavailable, use java SecureRandom */
-  private JavaSecureRandom fallback = null;
-  private static boolean nativeEnabled = false;
-  static {
-    if (NativeCodeLoader.isNativeCodeLoaded()) {
-      try {
-        OpensslSecureRandomNative.initSR();
-        nativeEnabled = true;
-      } catch (Throwable t) {
-        LOG.error("Failed to load Openssl SecureRandom", t);
-      }
-    }
-  }
-
-  /**
-   * Judges whether loading native library successfully.
-   *
-   * @return true if loading library successfully.
-   */
-  public static boolean isNativeCodeLoaded() {
-    return nativeEnabled;
-  }
-
-  /**
-   * Constructs a {@link com.intel.chimera.random.OpensslSecureRandom}.
-   *
-   * @param props the configuration properties.
-   */
-  public OpensslSecureRandom(Properties props) {
-    if (!nativeEnabled) {
-      fallback = new JavaSecureRandom(props);
-    }
-  }
-
-  /**
-   * Generates a user-specified number of random bytes.
-   * It's thread-safe.
-   *
-   * @param bytes the array to be filled in with random bytes.
-   */
-  @Override
-  public void nextBytes(byte[] bytes) {
-    if (!nativeEnabled || !OpensslSecureRandomNative.nextRandBytes(bytes)) {
-      fallback.nextBytes(bytes);
-    }
-  }
-
-  /**
-   * Overrides {@link OpensslSecureRandom}.
-   * For {@link OpensslSecureRandom}, we don't need to set seed.
-   *
-   * @param seed the initial seed.
-   */
-  @Override
-  public void setSeed(long seed) {
-    // Self-seeding.
-  }
-
-  /**
-   * Overrides {@link java.util.Random# next()}. Generates an integer
-   * containing the user-specified number of random
-   * bits(right justified, with leading zeros).
-   *
-   * @param numBits number of random bits to be generated, where
-   * 0 <= <code>numBits</code> <= 32.
-   * @return int an <code>int</code> containing the user-specified number
-   * of random bits (right justified, with leading zeros).
-   */
-  @Override
-  final protected int next(int numBits) {
-    Utils.checkArgument(numBits >= 0 && numBits <= 32);
-    int numBytes = (numBits + 7) / 8;
-    byte b[] = new byte[numBytes];
-    int next = 0;
-
-    nextBytes(b);
-    for (int i = 0; i < numBytes; i++) {
-      next = (next << 8) + (b[i] & 0xFF);
-    }
-
-    return next >>> (numBytes * 8 - numBits);
-  }
-
-  /**
-   * Overrides {@link java.lang.AutoCloseable#close()}. Closes openssl context if native enabled.
-   */
-  @Override
-  public void close() {
-    if (!nativeEnabled && fallback !=null) {
-      fallback.close();
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/commons-crypto/blob/4920d272/src/main/java/com/intel/chimera/random/OpensslSecureRandomNative.java
----------------------------------------------------------------------
diff --git a/src/main/java/com/intel/chimera/random/OpensslSecureRandomNative.java b/src/main/java/com/intel/chimera/random/OpensslSecureRandomNative.java
deleted file mode 100644
index 69f61ff..0000000
--- a/src/main/java/com/intel/chimera/random/OpensslSecureRandomNative.java
+++ /dev/null
@@ -1,40 +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 com.intel.chimera.random;
-
-/**
- * JNI interface of {@link SecureRandom} implementation.
- * The native method in this class is defined in
- * OpensslSecureRandomNative.h(genereted by javah).
- */
-public class OpensslSecureRandomNative {
-  /**
-   * Declares a native method to initialize SR.
-   */
-  public native static void initSR();
-
-  /**
-   * Judges whether use {@link OpensslSecureRandomNative} to
-   * generate the user-specified number of random bits.
-   *
-   * @param bytes the array to be filled in with random bytes.
-   * @return true if use {@link OpensslSecureRandomNative} to
-   * generate the user-specified number of random bits.
-   */
-  public native static boolean nextRandBytes(byte[] bytes); 
-}


Mime
View raw message