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

org.bouncycastle.jcajce.spec.UserKeyingMaterialSpec Maven / Gradle / Ivy

Go to download

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8.

The newest version!
package org.bouncycastle.jcajce.spec;

import java.security.spec.AlgorithmParameterSpec;

import org.bouncycastle.util.Arrays;

public class UserKeyingMaterialSpec
    implements AlgorithmParameterSpec
{
    private final byte[] userKeyingMaterial;
    private final byte[] salt;

    /**
     * Base constructor.
     *
     * @param userKeyingMaterial the bytes to be mixed in to the key agreement's KDF.
     */
    public UserKeyingMaterialSpec(byte[] userKeyingMaterial)
    {
        this(userKeyingMaterial, null);
    }

    /**
     * Base constructor.
     *
     * @param userKeyingMaterial the bytes to be mixed in to the key agreement's KDF.
     * @param salt the salt to use with the underlying KDF.
     */
    public UserKeyingMaterialSpec(byte[] userKeyingMaterial, byte[] salt)
    {
        this.userKeyingMaterial = Arrays.clone(userKeyingMaterial);
        this.salt = Arrays.clone(salt);
    }

    /**
     * Return a copy of the key material in this object.
     *
     * @return the user keying material.
     */
    public byte[] getUserKeyingMaterial()
    {
        return Arrays.clone(userKeyingMaterial);
    }

    /**
     * Return a copy of the salt in this object.
     *
     * @return the KDF salt.
     */
    public byte[] getSalt()
    {
        return Arrays.clone(salt);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy