/** * 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(boolean) generateInitializationVectors} value. * * @param streaming whether or not streaming is being performed * @return {@code true} if streaming or a value computed based on if the currently configured mode is compatible * with initialization vectors. */ @Override protected boolean isGenerateInitializationVectors(boolean streaming) { return streaming || super.isGenerateInitializationVectors() && isModeInitializationVectorCompatible(getModeName()); }
@Override protected byte[] generateInitializationVector(boolean streaming) { if (streaming) { String streamingModeName = getStreamingModeName(); if (!isModeInitializationVectorCompatible(streamingModeName)) { String msg = "streamingMode attribute value [" + streamingModeName + "] does not support " + "Initialization Vectors. Ensure the streamingMode value represents an operation mode " + "that is compatible with initialization vectors."; throw new IllegalStateException(msg); } } else { String modeName = getModeName(); if (!isModeInitializationVectorCompatible(modeName)) { String msg = "mode attribute value [" + modeName + "] does not support " + "Initialization Vectors. Ensure the mode value represents an operation mode " + "that is compatible with initialization vectors."; throw new IllegalStateException(msg); } } return super.generateInitializationVector(streaming); } }
private String buildTransformationString() { return buildTransformationString(getModeName(), getPaddingSchemeName(), getBlockSize()); }
/** * 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(boolean) generateInitializationVectors} value. * * @param streaming whether or not streaming is being performed * @return {@code true} if streaming or a value computed based on if the currently configured mode is compatible * with initialization vectors. */ @Override protected boolean isGenerateInitializationVectors(boolean streaming) { return streaming || super.isGenerateInitializationVectors() && isModeInitializationVectorCompatible(getModeName()); }
private String buildTransformationString() { return buildTransformationString(getModeName(), getPaddingSchemeName(), getBlockSize()); }
@Override protected byte[] generateInitializationVector(boolean streaming) { if (streaming) { String streamingModeName = getStreamingModeName(); if (!isModeInitializationVectorCompatible(streamingModeName)) { String msg = "streamingMode attribute value [" + streamingModeName + "] does not support " + "Initialization Vectors. Ensure the streamingMode value represents an operation mode " + "that is compatible with initialization vectors."; throw new IllegalStateException(msg); } } else { String modeName = getModeName(); if (!isModeInitializationVectorCompatible(modeName)) { String msg = "mode attribute value [" + modeName + "] does not support " + "Initialization Vectors. Ensure the mode value represents an operation mode " + "that is compatible with initialization vectors."; throw new IllegalStateException(msg); } } return super.generateInitializationVector(streaming); } }