![JAR search and dependency download from the Maven repository](/logo.png)
org.bouncycastle.jcajce.spec.EdDSASigParameterSpec 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.jcajce.spec;
import java.security.spec.AlgorithmParameterSpec;
import org.bouncycastle.util.Arrays;
/**
* ParameterSpec for EdDSA signature to allow for context and preHash.
*/
public class EdDSASigParameterSpec
implements AlgorithmParameterSpec
{
private final boolean preHash;
private final byte[] context;
/**
* Base constructor.
*
* @param preHash whether or not the signature is a preHash one.
*/
public EdDSASigParameterSpec(boolean preHash)
{
if (preHash != false)
{
throw new IllegalStateException("only false supported at the moment");
}
this.preHash = preHash;
this.context = null;
}
/**
* Base constructor.
*
* @param preHash whether or not the signature is a preHash one.
* @param context context to be added to the signature calculation.
*/
public EdDSASigParameterSpec(boolean preHash, byte[] context)
{
if (preHash != false)
{
throw new IllegalStateException("only false supported at the moment");
}
if (context.length > 255)
{
throw new IllegalStateException("context length > 255");
}
this.preHash = preHash;
this.context = Arrays.clone(context);
}
/**
* Return the context to be used for the signature.
*
* @return the signature context.
*/
public byte[] getContext()
{
return Arrays.clone(context);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy