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

org.bouncycastle.jcajce.spec.HKDFParameterSpec 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.jcajce.spec;

import java.security.spec.AlgorithmParameterSpec;

import org.bouncycastle.util.Arrays;

public class HKDFParameterSpec
    implements AlgorithmParameterSpec
{
    private final byte[] salt;
    private final byte[] info;

    /**
     * Construct parameters for HKDF, specifying both the optional salt and
     * optional info.
     *
     * @param salt the salt to use, may be null for a salt for hashLen zeros
     * @param info the info to use, may be null for an info field of zero bytes
     */
    public HKDFParameterSpec(final byte[] salt, final byte[] info)
    {
        this.salt = Arrays.clone(salt);
        this.info = Arrays.clone(info);
    }

    /**
     * Construct parameters for HKDF, specifying just optional salt.
     *
     * @param salt the salt to use, may be null for a salt for hashLen zeros
     */
    public HKDFParameterSpec(final byte[] salt)
    {
        this(salt, null);
    }
    
    /**
     * Returns the salt, or null if the salt should be generated as a byte array
     * of HashLen zeros.
     *
     * @return the salt, or null
     */
    public byte[] getSalt()
    {
        return Arrays.clone(salt);
    }

    /**
     * Returns the info field, which may be empty (null is converted to empty).
     *
     * @return the info field, never null
     */
    public byte[] getInfo()
    {
        return Arrays.clone(info);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy