Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package io.github.mmm.crypto;
import io.github.mmm.crypto.algorithm.CryptoAlgorithm;
/**
* The abstract interface for any object that is based on a security {@link #getAlgorithm() algorithm}.
*
* @author Joerg Hohwiller (hohwille at users.sourceforge.net)
* @since 1.0.0
*/
public abstract interface CryptoProcessor extends CryptoAlgorithm {
/**
* Generic method to process and transform data.
*
*
*
{@link CryptoProcessor}
*
Equivalent of {@link #process(byte[]) process}(input)
throw new {@link UnsupportedOperationException}();
*
*
*
* @param input the data to process.
* @param offset the index where to start reading data from {@code input}.
* @param length the number of bytes to read from {@code input}.
* @return the transformed {@code input} data.
*/
default byte[] process(byte[] input, int offset, int length) {
return process(input, offset, length, true);
}
/**
* Generic method to process and transform data.
*
throw new {@link UnsupportedOperationException}();
*
*
*
* @param input the data to process.
* @param offset the index where to start reading data from {@code input}.
* @param length the number of bytes to read from {@code input}.
* @param complete - {@code true} to complete/reset this processor after processing the given {@code input},
* {@code false} otherwise.
* @return the transformed {@code input} data.
*/
default byte[] process(byte[] input, int offset, int length, boolean complete) {
throw new UnsupportedOperationException();
}
/**
* @param input the {@link CryptoBinary} {@link CryptoBinary#getData() containing the data} to process.
* @param complete - {@code true} to complete/reset this processor after processing the given {@code input},
* {@code false} otherwise.
* @return the transformed {@code input} data.
* @see #process(byte[])
*/
default byte[] process(CryptoBinary input, boolean complete) {
byte[] data = input.getRawData();
return process(data, 0, data.length, complete);
}
/**
* Will reset the internal state of this object. Please note that complex algorithms especially for
* {@link io.github.mmm.crypto.crypt.Cryptor} may not reusable. It is therefore preferable to always create a
* fresh instance for each cryptographic task.
*
* @see java.security.MessageDigest#reset()
*/
void reset();
}