Creates a new {@link CipherService} instance using the {@code AES} cipher algorithm with the following important cipher default attributes: <table> <tr> <th>Attribute</th> <th>Value</th> </tr> <tr> <td>{@link #setKeySize keySize}</td> <td>{@code 128} bits</td> </tr> <tr> <td>{@link #setBlockSize blockSize}</td> <td>{@code 128} bits (required for {@code AES}</td> </tr> <tr> <td>{@link #setMode mode}</td> <td>{@link OperationMode#CBC CBC}<b>*</b></td> </tr> <tr> <td>{@link #setPaddingScheme paddingScheme}</td> <td>{@link PaddingScheme#PKCS5 PKCS5}</td> </tr> <tr> <td>{@link #setInitializationVectorSize(int) initializationVectorSize}</td> <td>{@code 128} bits</td> </tr> <tr> <td>{@link #setGenerateInitializationVectors(boolean) generateInitializationVectors}</td> <td>{@code true}<b>**</b></td> </tr> </table> <p/> <b>*</b> The {@link OperationMode#CBC CBC} operation mode is used instead of the JDK default {@code ECB} to ensure strong encryption. {@code ECB} should not be used in security-sensitive environments - see the {@link DefaultBlockCipherService DefaultBlockCipherService} class JavaDoc's "Operation Mode" section for more. <p/> <b>**</b>In conjunction with the default {@code CBC} operation mode, initialization vectors are generated by default to ensure strong encryption. See the {@link JcaCipherService JcaCipherService} class JavaDoc for more.
Returns the cipher operation mode name (as a string) to be used when constructing {@link javax.crypto.Cipher Cipher} transformation string or {@code null} if the JCA Provider default mode for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #getStreamingModeName() streamingModeName} attribute is used when the block cipher is used for streaming operations. <p/> The default value is {@code null} to retain the JCA Provider default.
Sets the cipher operation mode name to be used when constructing the {@link javax.crypto.Cipher Cipher} transformation string. A {@code null} value indicates that the JCA Provider default mode for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #getStreamingModeName() streamingModeName} attribute is used when the block cipher is used for streaming operations. <p/> The default value is {@code null} to retain the JCA Provider default. <p/> <b>NOTE:</b> most standard mode names are represented by the {@link OperationMode OperationMode} enum. That enum should be used with the {@link #setMode mode} attribute when possible to retain type-safety and reduce the possibility of errors. This method is better used if the {@link OperationMode} enum does not represent the necessary mode.
Sets the cipher operation mode of operation to be used when constructing the {@link javax.crypto.Cipher Cipher} transformation string. A {@code null} value indicates that the JCA Provider default mode for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #setStreamingMode streamingMode} attribute is used when the block cipher is used for streaming operations. <p/> If the {@link OperationMode} enum cannot represent your desired mode, you can set the name explicitly via the {@link #setModeName modeName} attribute directly. However, because {@link OperationMode} represents all standard JDK mode names already, ensure that your underlying JCA Provider supports the non-standard name first.
Returns the cipher algorithm padding scheme name (as a string) to be used when constructing {@link javax.crypto.Cipher Cipher} transformation string or {@code null} if the JCA Provider default mode for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #getStreamingPaddingSchemeName() streamingPaddingSchemeName} attribute is used when the block cipher is used for streaming operations. <p/> The default value is {@code null} to retain the JCA Provider default.
Sets the padding scheme name to be used when constructing the {@link javax.crypto.Cipher Cipher} transformation string, or {@code null} if the JCA Provider default mode for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #getStreamingPaddingSchemeName() streamingPaddingSchemeName} attribute is used when the block cipher is used for streaming operations. <p/> The default value is {@code null} to retain the JCA Provider default. <p/> <b>NOTE:</b> most standard padding schemes are represented by the {@link PaddingScheme PaddingScheme} enum. That enum should be used with the {@link #setPaddingScheme paddingScheme} attribute when possible to retain type-safety and reduce the possibility of errors. Calling this method however is suitable if the {@code PaddingScheme} enum does not represent the desired scheme.
Sets the padding scheme to be used when constructing the {@link javax.crypto.Cipher Cipher} transformation string. A {@code null} value indicates that the JCA Provider default padding scheme for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #setStreamingPaddingScheme streamingPaddingScheme} attribute is used when the block cipher is used for streaming operations. <p/> If the {@link PaddingScheme PaddingScheme} enum does represent your desired scheme, you can set the name explicitly via the {@link #setPaddingSchemeName paddingSchemeName} attribute directly. However, because {@code PaddingScheme} represents all standard JDK scheme names already, ensure that your underlying JCA Provider supports the non-standard name first.
Returns the block cipher's block size to be used when constructing {@link javax.crypto.Cipher Cipher} transformation string or {@code 0} if the JCA Provider default block size for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #getStreamingBlockSize() streamingBlockSize} attribute is used when the block cipher is used for streaming operations. <p/> The default value is {@code 0} which retains the JCA Provider default.
Sets the block cipher's block size to be used when constructing {@link javax.crypto.Cipher Cipher} transformation string. {@code 0} indicates that the JCA Provider default block size for the specified {@link #getAlgorithmName() algorithm} should be used. <p/> This attribute is used <em>only</em> when constructing the transformation string for block (byte array) operations ({@link #encrypt(byte[], byte[])} and {@link #decrypt(byte[], byte[])}). The {@link #getStreamingBlockSize() streamingBlockSize} attribute is used when the block cipher is used for streaming operations. <p/> The default value is {@code 0} which retains the JCA Provider default. <p/> <b>NOTE:</b> block cipher block sizes are very algorithm-specific. If you change this value, ensure that it will work with the specified {@link #getAlgorithmName() algorithm}.
Same purpose as the {@link #getModeName modeName} attribute, but is used instead only for for streaming operations ({@link #encrypt(java.io.InputStream, java.io.OutputStream, byte[])} and {@link #decrypt(java.io.InputStream, java.io.OutputStream, byte[])}). <p/> Note that unlike the {@link #getModeName modeName} attribute, the default value of this attribute is not {@code null} - it is {@link OperationMode#CBC CBC} for reasons described in the class-level JavaDoc in the {@code Streaming} section.
Sets the transformation string mode name to be used for streaming operations only. The default value is {@link OperationMode#CBC CBC} for reasons described in the class-level JavaDoc in the {@code Streaming} section.
Sets the transformation string mode to be used for streaming operations only. The default value is {@link OperationMode#CBC CBC} for reasons described in the class-level JavaDoc in the {@code Streaming} section.
Returns the transformation string to use with the {@link javax.crypto.Cipher#getInstance} call. If {@code streaming} is {@code true}, a block-cipher transformation string compatible with streaming operations will be constructed and cached for re-use later (see the class-level JavaDoc for more on using block ciphers for streaming). If {@code streaming} is {@code false} a normal block-cipher transformation string will be constructed and cached for later re-use.
Overrides the parent implementation to ensure initialization vectors are always generated if streaming is enabled (block ciphers <em>must</em> use initialization vectors if they are to be used as a stream cipher). If not being used as a stream cipher, then the value is computed based on whether or not the currently configured {@link #getModeName modeName} is compatible with initialization vectors as well as the result of the configured {@link #setGenerateInitializationVectors(bool) generateInitializationVectors} value.
{@code CipherService} using the {@code AES} cipher algorithm for all encryption, decryption, and key operations. <p/> The AES algorithm can support key sizes of {@code 128}, {@code 192} and {@code 256} bits<b>*</b>. This implementation defaults to 128 bits. <p/> Note that this class retains the parent class's default {@link OperationMode#CBC CBC} mode of operation instead of the typical JDK default of {@link OperationMode#ECB ECB}. {@code ECB} should not be used in security-sensitive environments because {@code ECB} does not allow for initialization vectors, which are considered necessary for strong encryption. See the {@link DefaultBlockCipherService parent class}'s JavaDoc and the {@link JcaCipherService JcaCipherService} JavaDoc for more on why the JDK default should not be used and is not used in this implementation. <p/> <b>*</b> Generating and using AES key sizes greater than 128 require installation of the <a href="http://java.sun.com/javase/downloads/index.jsp">Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy files</a>.
@since 1.0