Search in sources :

Example 6 with ClassicDataObject

use of org.jcryptool.core.operations.dataobject.classic.ClassicDataObject in project core by jcryptool.

the class AbstractClassicAlgorithm method init.

/**
 * Initializes the Algorithm with its key parameters
 *
 * @param opmode encrypt or decrypt (mode)
 * @param input input text
 * @param alphabet filter alphabet
 * @param key the operation's key
 * @param transformData the transformation data used to transform the text before the real operation, may be
 *            <code>null</code> in case no transformation should be applied
 */
public void init(int opmode, InputStream input, AbstractAlphabet alphabet, char[] key, TransformData transformData) {
    this.dataObject = new ClassicDataObject();
    this.dataObject.setTransformData(transformData);
    try {
        this.dataObject.setInputStream(filterStreamByTransformData(input, transformData));
    } catch (Exception e) {
        LogUtil.logError(OperationsPlugin.PLUGIN_ID, e);
        this.dataObject.setInputStream(input);
    }
    this.dataObject.setAlphabet(alphabet);
    this.dataObject.setKey(key);
    this.dataObject.setOpmode(opmode);
}
Also used : ClassicDataObject(org.jcryptool.core.operations.dataobject.classic.ClassicDataObject) IOException(java.io.IOException) UnsupportedEncodingException(java.io.UnsupportedEncodingException)

Aggregations

ClassicDataObject (org.jcryptool.core.operations.dataobject.classic.ClassicDataObject)6 IOException (java.io.IOException)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 ICommandService (org.eclipse.ui.commands.ICommandService)1 ActionItem (org.jcryptool.actions.core.types.ActionItem)1 AbstractClassicAlgorithm (org.jcryptool.core.operations.algorithm.classic.AbstractClassicAlgorithm)1 AbstractModernAlgorithm (org.jcryptool.core.operations.algorithm.modern.AbstractModernAlgorithm)1 AbstractAlphabet (org.jcryptool.core.operations.alphabets.AbstractAlphabet)1 IDataObject (org.jcryptool.core.operations.dataobject.IDataObject)1 IClassicDataObject (org.jcryptool.core.operations.dataobject.classic.IClassicDataObject)1 IModernDataObject (org.jcryptool.core.operations.dataobject.modern.IModernDataObject)1 ModernDataObject (org.jcryptool.core.operations.dataobject.modern.ModernDataObject)1