User guideApache Commons Crypto 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 Apache Commons Crypto doesn't implement the cryptographic algorithm such as AES directly. It wraps OpenSSL or JCE which implement the algorithms. OpenSSL 1.1.1 is required for building and running. Interfaces OverviewInterfaces and classes used by the various implementation in the sub-packages.
UsagePrerequisites
Commons Crypto relies on standard JDK 1.8 (or above) and OpenSSL 1.1.1 for production
deployment.
If it is installed, the command OpenSSL may already be installed on your system; if not, please visit OpenSSL.org for information on installation. Using Commons Crypto in your Apache Maven buildTo build with Apache Maven, add the dependencies listed below to your pom.xml file. <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-crypto</artifactId> <version>1.1.0</version> </dependency> Usage of Random APICryptoRandom provides a cryptographically strong random number generators. The default implementation will use Intel® Digital Random Number Generator (DRNG) for accelerating the random generation. RandomExample.javaUsage of Cipher APICipher provides an cryptographic interface for encryption and decryption. We provide two kind of implementations: JCE Cipher and OpenSSL Cipher. The JCE implementation uses JCE provider and the OpenSSL implementation uses Intel® AES New Instructions (Intel® AES NI). Usage of Byte Array Encryption/DecryptionCipherByteArrayExample.javaUsage of ByteBuffer Encryption/DecryptionCipherByteBufferExample.javaUsage of Stream APIStream provides the data encryption and decryption in stream manner. We provide CryptoInputStream, CTRCryptoInputStream, PositionedCryptoInputStream implementations for InputStream and CryptoOutputStream, CTRCryptoOutputStream implementations for OutputStream. Usage of stream encryption/decryptionStreamExample.java |