java.lang.Object
net.i2p.crypto.ECConstants
Constants for elliptic curves, from NIST FIPS 186-4 (2013) / ANSI X9.62.
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classThe parameters of one elliptic curve.Field Summary
Modifier and TypeFieldDescriptionprivate static final booleanTrue when Bouncy Castle is present.private static final booleanTrue to log the parameter verification.static final ECParameterSpecP256_SPEC.static final ECParameterSpecP384_SPEC.static final ECParameterSpecP521_SPEC.private static final ECConstants.ECParmsThe parameters of the P-256 curve.private static final ECConstants.ECParmsThe parameters of the P-384 curve.private static final ECConstants.ECParmsThe parameters of the P-521 curve.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic booleanequals(ECParameterSpec s1, ECParameterSpec s2) There is noObject.equals(Object).private static ECParameterSpecGenerate a spec from a curve name.private static ECParameterSpecgenSpec(String name1, String name2, ECConstants.ECParms parms) Tries curve name1, then name2, then creates new from parms.static booleanReturn whether Bouncy Castle is available.private static voidLogs a debug message.private static voidLogs a debug message with a cause.
Field Details
DEBUG
private static final boolean DEBUGTrue to log the parameter verification.- See Also:
BC_AVAILABLE
private static final boolean BC_AVAILABLETrue when Bouncy Castle is present.PARM_P256
The parameters of the P-256 curve.PARM_P384
The parameters of the P-384 curve.PARM_P521
The parameters of the P-521 curve.P256_SPEC
P256_SPEC.P384_SPEC
P384_SPEC.P521_SPEC
P521_SPEC.
Constructor Details
ECConstants
ECConstants()Constructor. The curve, domain and provider lookups below all run in the static initializer, so an instance holds nothing.
Method Details
log
log
isBCAvailable
public static boolean isBCAvailable()Return whether Bouncy Castle is available.- Returns:
- whether BC available
genSpec
Generate a spec from a curve name.- Parameters:
name- the standard curve name, e.g. secp256r1- Returns:
- null if fail
genSpec
Tries curve name1, then name2, then creates new from parms.- Parameters:
name1- the first standard curve name to tryname2- null to skipparms- null to skip- Returns:
- null if all fail
equals
There is noObject.equals(Object). Needed to load family keys on Android viaSigUtil.fromJavaKey(PublicKey).- Parameters:
s1- the spec being compared; null is tolerated only ifs2is also nulls2- the spec being compared; null is tolerated only ifs1is also null- Returns:
- true if equal