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

org.bouncycastle.crypto.PasswordBasedDeriver Maven / Gradle / Ivy

Go to download

The FIPS 140-2 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-2 level 1. This jar contains the debug version JCE provider and low-level API for the BC-FJA version 1.0.2.3, FIPS Certificate #3514. Please note the debug jar is not certified.

There is a newer version: 2.0.0
Show newest version
package org.bouncycastle.crypto;

/**
 * Base interface for a password based deriver of bytes for symmetric keys.
 *
 * @param  the parameters type for the deriver.
 */
public interface PasswordBasedDeriver
{
    /**
     * The target key type we are trying to produce a key for.
     */
    static enum KeyType
    {
        /**
         * Target key for a symmetric cipher.
         */
        CIPHER,
        /**
         * Target key for a MAC.
         */
        MAC,
    }

    /**
     * Return the parameters for this deriver.
     *
     * @return the deriver's parameters.
     */
    T getParameters();

    /**
     * Derive a key of the given keySizeInBytes length.
     *
     * @param keyType type of key to be calculated.
     * @param keySizeInBytes the number of bytes to be produced.
     * @return a byte array containing the raw key data.
     */
    byte[] deriveKey(KeyType keyType, int keySizeInBytes);

    /**
     * Derive a key of the given keySizeInBytes length and an iv of ivSizeInBytes length.
     *
     * @param keyType type of key to be calculated.
     * @param keySizeInBytes the number of bytes to be produced.
     * @param ivSizeInBytes the number of bytes to be produced.
     * @return a 2 element byte[] array containing the raw key data in element 0, the iv in element 1.
     */
    byte[][] deriveKeyAndIV(KeyType keyType, int keySizeInBytes, int ivSizeInBytes);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy