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 Long Term Stable (LTS) Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains the JCA/JCE provider and low-level API for the BC LTS version 2.73.7 for Java 8 and later.

There is a newer version: 2.73.7
Show 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