![JAR search and dependency download from the Maven repository](/logo.png)
org.bouncycastle.crypto.asymmetric.AsymmetricLMSKey Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bc-fips-debug Show documentation
Show all versions of bc-fips-debug Show documentation
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.
package org.bouncycastle.crypto.asymmetric;
import org.bouncycastle.crypto.Algorithm;
import org.bouncycastle.crypto.AsymmetricKey;
import org.bouncycastle.crypto.CryptoServicesRegistrar;
import org.bouncycastle.crypto.fips.FipsUnapprovedOperationError;
import org.bouncycastle.crypto.general.LMS;
/**
* Leighton-Micali Hash-Based Signatures (LMS) keys.
*/
public abstract class AsymmetricLMSKey
implements AsymmetricKey
{
private final boolean approvedModeOnly;
private Algorithm algorithm;
protected final int L;
AsymmetricLMSKey(int L)
{
this.approvedModeOnly = CryptoServicesRegistrar.isInApprovedOnlyMode();
this.algorithm = LMS.ALGORITHM;
this.L = L;
}
/**
* Return the algorithm this Edwards Curve key is for.
*
* @return the key's algorithm.
*/
public Algorithm getAlgorithm()
{
return algorithm;
}
/**
* Return the number of levels (L) associated with the key.
*
* @return L.
*/
public int getL()
{
return L;
}
protected void zeroize()
{
this.algorithm = null;
}
protected final boolean isThreadCorrectMode()
{
return approvedModeOnly == CryptoServicesRegistrar.isInApprovedOnlyMode();
}
protected final void checkApprovedOnlyModeStatus()
{
if (!isThreadCorrectMode())
{
throw new FipsUnapprovedOperationError("No access to key in current thread.");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy