org.bouncycastle.jcajce.spec.XDHParameterSpec 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.asn1.edec.EdECObjectIdentifiers;
/**
* ParameterSpec for XDH key agreement algorithms.
*/
public class XDHParameterSpec
implements AlgorithmParameterSpec
{
public static final String X25519 = "X25519";
public static final String X448 = "X448";
private final String curveName;
/**
* Base constructor.
*
* @param curveName name of the curve to specify.
*/
public XDHParameterSpec(String curveName)
{
if (curveName.equalsIgnoreCase(X25519))
{
this.curveName = X25519;
}
else if (curveName.equalsIgnoreCase(X448))
{
this.curveName = X448;
}
else if (curveName.equals(EdECObjectIdentifiers.id_X25519.getId()))
{
this.curveName = X25519;
}
else if (curveName.equals(EdECObjectIdentifiers.id_X448.getId()))
{
this.curveName = X448;
}
else
{
throw new IllegalArgumentException("unrecognized curve name: " + curveName);
}
}
/**
* Return the curve name specified by this parameterSpec.
*
* @return the name of the curve this parameterSpec specifies.
*/
public String getCurveName()
{
return curveName;
}
}