commit | 7dc37b4b88fdffd8e274404fee0d19aafb71e3bd | [log] [tgz] |
---|---|---|
author | Ferdinand Xu <cheng.a.xu@intel.com> | Mon Jan 04 21:03:07 2016 -0500 |
committer | Ferdinand Xu <cheng.a.xu@intel.com> | Mon Jan 04 21:03:07 2016 -0500 |
tree | 9188d99bbaba839024d44db06cad7c3f11806dd7 | |
parent | 1210902edfa9a0ba3444721d09ec72d8d7b9fc3c [diff] |
0.9.0 release
Chimera is a project which strips code related to CryptoInputStream/CryptoOutputStream from Hadoop to facilitate AES-NI based data encryption in other projects.
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.0</version> <type>jar</type> <scope>compile</scope> </dependency>
libraryDependencies += "com.intel.chimera" % "chimera" % "0.9.0"
CryptoCodec codec = CryptoCodec.getInstance(); 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, codec, bufferSize, key, iv); cos.write(input.getBytes("UTF-8")); cos.flush(); cos.close(); // Decrypt CryptoInputStream cis = new CryptoInputStream(new ByteArrayInputStream(os.toByteArray()), codec, bufferSize, key, iv); int decryptedLen = cis.read(decryptedData, 0, 1024);
Currently, two crypto codec are supported: JceAesCtrCryptoCodec and OpensslAesCtrCryptoCodec, you can configure which codec to use as follows:
$ java -Dchimera.crypto.codec.classes.aes.ctr.nopadding=com.intel.chimera.OpensslAesCtrCryptoCodec Sample $ java -Dchimera.crypto.codec.classes.aes.ctr.nopadding=com.intel.chimera.JceAesCtrCryptoCodec Sample
Building from the source code is an option when your OS platform and CPU architecture is not supported. To build chimera, you need Git, JDK (1.6 or higher), g++ compiler (mingw in Windows) etc.
$ git clone https://github.com/intel-hadoop/chimera.git $ cd chimera $ make
A file target/chimera-$(version).jar
is the product additionally containing the native library built for your platform.
gpg --gen-key # generate gpg public/private key pair gpg --list-keys # list available public/private key pairs gpg --keyserver hkp://pgp.mit.edu --send-keys [public key] # we use mit pgp server, you can also choose others
Set Sonatype account information (user name and password) in the global sbt settings [$HOME/.sbt/(sbt-version)/sonatype.sbt]. credentials += Credentials(“Sonatype Nexus Repository Manager”, “oss.sonatype.org”, “(Sonatype user name)”, “(Sonatype password)”)
make clean; # clean up the environment make publishSigned; # publish your GPG-signed artifact to staging repository of Sonatype, related files will be uploaded to Sonatype server in this step make sonatypeRelease; # make a release. You can also make a release manually in the site of Sonatype [https://oss.sonatype.org].
chimera uses sbt (simple build tool for Scala) as a build tool. Here is a simple usage
$ ./sbt # enter sbt console > ~test # run tests upon source code change > ~test-only * # run tests that matches a given name pattern > publishM2 # publish jar to $HOME/.m2/repository > package # create jar file