Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.bouncycastle.crypto.engines;
 
The no-op engine that just copies bytes through, irrespective of whether encrypting and decrypting. Provided for the sake of completeness.
public class NullEngine implements BlockCipher
    private boolean initialised;
    protected static final int DEFAULT_BLOCK_SIZE = 1;
    private final int blockSize;

    
Constructs a null engine with a block size of 1 byte.
    public NullEngine()
    {
        this();
    }

    
Constructs a null engine with a specific block size.

Parameters:
blockSize the block size in bytes.
    public NullEngine(int blockSize)
    {
        this. = blockSize;
    }
    /* (non-Javadoc)
     * @see org.bouncycastle.crypto.BlockCipher#init(boolean, org.bouncycastle.crypto.CipherParameters)
     */
    public void init(boolean forEncryptionCipherParameters paramsthrows IllegalArgumentException
    {
        // we don't mind any parameters that may come in
        this. = true;
    }
    /* (non-Javadoc)
     * @see org.bouncycastle.crypto.BlockCipher#getAlgorithmName()
     */
    public String getAlgorithmName()
    {
        return "Null";
    }
    /* (non-Javadoc)
     * @see org.bouncycastle.crypto.BlockCipher#getBlockSize()
     */
    public int getBlockSize()
    {
        return ;
    }
    /* (non-Javadoc)
     * @see org.bouncycastle.crypto.BlockCipher#processBlock(byte[], int, byte[], int)
     */
    public int processBlock(byte[] inint inOffbyte[] outint outOff)
    {
        if (!)
        {
            throw new IllegalStateException("Null engine not initialised");
        }
        if ((inOff + ) > in.length)
        {
            throw new DataLengthException("input buffer too short");
        }
        if ((outOff + ) > out.length)
        {
            throw new OutputLengthException("output buffer too short");
        }
        for (int i = 0; i < ; ++i)
        {
            out[outOff + i] = in[inOff + i];
        }
        return ;
    }
    /* (non-Javadoc)
     * @see org.bouncycastle.crypto.BlockCipher#reset()
     */
    public void reset()
    {
        // nothing needs to be done
    }
New to GrepCode? Check out our FAQ X