org.bouncycastle.jcajce.spec.UserKeyingMaterialSpec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-ext-debug-jdk18on Show documentation
Show all versions of bcprov-ext-debug-jdk18on Show documentation
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 Java 1.8 and later with debug enabled.
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);
}
}