org.bouncycastle.pqc.crypto.lms.HSSKeyGenerationParameters Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-jdk15on Show documentation
Show all versions of bcprov-jdk15on 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 JDK 1.5 and up.
package org.bouncycastle.pqc.crypto.lms;
import java.security.SecureRandom;
import org.bouncycastle.crypto.KeyGenerationParameters;
public class HSSKeyGenerationParameters
extends KeyGenerationParameters
{
private final LMSParameters[] lmsParameters;
/**
* Base constructor - parameters and a source of randomness.
*
* @param lmsParameters array of LMS parameters, one per level in the hierarchy (up to 8 levels).
* @param random the random byte source.
*/
public HSSKeyGenerationParameters(
LMSParameters[] lmsParameters,
SecureRandom random)
{
super(random, LmsUtils.calculateStrength(lmsParameters[0]));
if (lmsParameters.length == 0 || lmsParameters.length > 8) // RFC 8554, Section 6.
{
throw new IllegalArgumentException("lmsParameters length should be between 1 and 8 inclusive");
}
this.lmsParameters = lmsParameters;
}
public int getDepth()
{
return lmsParameters.length;
}
public LMSParameters[] getLmsParameters()
{
return lmsParameters;
}
}