/** * 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. * * @param mode the cipher operation mode 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. */ public void setMode(OperationMode mode) { setModeName(mode.name()); }
/** * 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. * * @param mode the cipher operation mode 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. */ public void setMode(OperationMode mode) { setModeName(mode.name()); }