org.bouncycastle.crypto.util.SSHNamedCurves Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bcprov-jdk15to18 Show documentation
Show all versions of bcprov-jdk15to18 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 to JDK 1.8.
package org.bouncycastle.crypto.util;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.nist.NISTNamedCurves;
import org.bouncycastle.asn1.sec.SECObjectIdentifiers;
import org.bouncycastle.asn1.x9.X9ECParameters;
import org.bouncycastle.crypto.ec.CustomNamedCurves;
import org.bouncycastle.crypto.params.ECDomainParameters;
import org.bouncycastle.crypto.params.ECNamedDomainParameters;
import org.bouncycastle.math.ec.ECCurve;
import org.bouncycastle.util.Strings;
public class SSHNamedCurves
{
private static final Map oidToName;
private static final Map oidMap =
Collections.unmodifiableMap(new HashMap()
{
{
put("nistp256", SECObjectIdentifiers.secp256r1);
put("nistp384", SECObjectIdentifiers.secp384r1);
put("nistp521", SECObjectIdentifiers.secp521r1);
put("nistk163", SECObjectIdentifiers.sect163k1);
put("nistp192", SECObjectIdentifiers.secp192r1);
put("nistp224", SECObjectIdentifiers.secp224r1);
put("nistk233", SECObjectIdentifiers.sect233k1);
put("nistb233", SECObjectIdentifiers.sect233r1);
put("nistk283", SECObjectIdentifiers.sect283k1);
put("nistk409", SECObjectIdentifiers.sect409k1);
put("nistb409", SECObjectIdentifiers.sect409r1);
put("nistt571", SECObjectIdentifiers.sect571k1);
}
});
private static final Map curveNameToSSHName = Collections.unmodifiableMap(new HashMap()
{
{
String[][] curves = {
{"secp256r1", "nistp256"},
{"secp384r1", "nistp384"},
{"secp521r1", "nistp521"},
{"sect163k1", "nistk163"},
{"secp192r1", "nistp192"},
{"secp224r1", "nistp224"},
{"sect233k1", "nistk233"},
{"sect233r1", "nistb233"},
{"sect283k1", "nistk283"},
{"sect409k1", "nistk409"},
{"sect409r1", "nistb409"},
{"sect571k1", "nistt571"}
};
for (int i = 0; i != curves.length; i++)
{
String[] item = curves[i];
put(item[0], item[1]);
}
}
});
private static HashMap curveMap = new HashMap()
{
{
Enumeration