commit | 69b9c05ad80e3e3b24fe64704b9d68213fdfb8ec | [log] [tgz] |
---|---|---|
author | Ferdinand Xu <cheng.a.xu@intel.com> | Sun Jan 31 21:53:40 2016 -0500 |
committer | Ferdinand Xu <cheng.a.xu@intel.com> | Sun Jan 31 21:53:40 2016 -0500 |
tree | 0132c723d56cd9444a160c92efb777f2b4090944 | |
parent | 319be95ff6e1b24713b4e9e18617b8e5a989eb73 [diff] |
Update 0.9.1 release version
Chimera is a cryptographic library optimized with AES-NI (Advanced Encryption Standard New Instructions). It provides Java API for both cipher level and Java stream level. Developers can use it to implement high performance AES encryption/decryption with the minimum code and effort. Please note that Chimera doesn't implement the cryptographic algorithm such as AES directly. It wraps to Openssl or JCE which implement the algorithms.
os.name
and os.arch
).Add the following dependency to your pom.xml:
<dependency> <groupId>com.intel.chimera</groupId> <artifactId>chimera</artifactId> <version>0.9.1</version> <type>jar</type> <scope>compile</scope> </dependency>
libraryDependencies += "com.intel.chimera" % "chimera" % "0.9.1"
Properties properties = new Properties(); properties.setProperty("chimera.crypto.cipher.classes", "com.intel.chimera.crypto.OpensslCipher"); Cipher cipher = Utils.getCipherInstance(CipherTransformation.AES_CTR_NOPADDING, properties); byte[] key = new byte[16]; byte[] iv = new byte[16]; int bufferSize = 4096; String input = "hello world!"; byte[] decryptedData = new byte[1024]; // Encrypt ByteArrayOutputStream os = new ByteArrayOutputStream(); CryptoOutputStream cos = new CryptoOutputStream(os, cipher, bufferSize, key, iv); cos.write(input.getBytes("UTF-8")); cos.flush(); cos.close(); // Decrypt CryptoInputStream cis = new CryptoInputStream(new ByteArrayInputStream(os.toByteArray()), cipher, bufferSize, key, iv); int decryptedLen = cis.read(decryptedData, 0, 1024);
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
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. |
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.
$ git clone https://github.com/intel-hadoop/chimera.git $ cd chimera $ mvn clean install
A file target/chimera-$(version).jar
is the product additionally containing the native library built for your platform.
For development related discussion, please go to dev google group. For issues or bugs, please file tickets through github.