All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.tls.crypto.impl.TlsBlockCipherImpl Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for the TLS, including a JSSE provider. The APIs are designed primarily to be used in conjunction with the BC FIPS provider. The APIs may also be used with other providers although if being used in a FIPS context it is the responsibility of the user to ensure that any other providers used are FIPS certified and used appropriately.

There is a newer version: 2.0.19
Show newest version
package org.bouncycastle.tls.crypto.impl;

import java.io.IOException;

/**
 * Interface for block cipher services.
 */
public interface TlsBlockCipherImpl
{
    /**
     * Set the key to be used by the block cipher implementation supporting this service.
     *
     * @param key array holding the block cipher key.
     * @param keyOff offset into the array the key starts at.
     * @param keyLen length of the key in the array.
     */
    void setKey(byte[] key, int keyOff, int keyLen) throws IOException;

    /**
     * Initialise the parameters for operator.
     *
     * @param iv array holding the initialization vector (IV).
     * @param ivOff offset into the array the IV starts at.
     * @param ivLen length of the IV in the array.
     * @throws IOException if the parameters are inappropriate.
     */
    void init(byte[] iv, int ivOff, int ivLen) throws IOException;

    /**
     * Perform the cipher encryption/decryption returning the output in output.
     * 

* Note: we have to use doFinal() here as it is the only way to guarantee output from the underlying cipher. *

* @param input array holding input data to the cipher. * @param inputOffset offset into input array data starts at. * @param inputLength length of the input data in the array. * @param output array to hold the cipher output. * @param outputOffset offset into output array to start saving output. * @return the amount of data written to output. * @throws IOException in case of failure. */ int doFinal(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws IOException; /** * Return the blocksize (in bytes) of the underlying block cipher. * * @return the cipher's blocksize. */ int getBlockSize(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy