public class LunaECUtils extends Object
| Constructor and Description |
|---|
LunaECUtils() |
| Modifier and Type | Method and Description |
|---|---|
static BigInteger |
bi(String s)
Convert the given String representing a hexadecimal number
into a BigInteger.
|
static ECPoint |
decodePoint(byte[] data,
EllipticCurve curve)
Converts the a byte representation of a point on the given elliptic
curve into an ECPoint object.
|
static byte[] |
encodePoint(ECPoint point,
EllipticCurve curve)
Converts an ECPoint on the given elliptic curve into an ASN.1-encoded
octet string (as required by the Luna hardware).
|
static byte[] |
encodePointNoAsn(ECPoint point,
EllipticCurve curve)
Converts an ECPoint on the given elliptic curve into a byte array as
specified in SEC1 2.3.3.
|
static String |
getCurveCommonName(ECParameterSpec params)
Given a set of parameters, returns the common name of the
curve (ex.
|
static String |
getCurveName(ECParameterSpec params)
Given a set of parameters, returns the a String representation
of the curve's OID (ex.
|
static int |
getFieldSize(ECParameterSpec spec)
Return the field size of the curve defined by the given spec
|
static int |
getRawSignatureSize(ECKey key)
Returns the size of a raw ECDSA signature generated on the HSM
for the given key.
|
static boolean |
isCompressed(byte[] point)
Detects if a given encoded EC point is using compressed notation.
|
public static ECPoint decodePoint(byte[] data, EllipticCurve curve)
data - The ASN.1-encoded byte representation of an EC pointcurve - The curve on which the point residesLunaException - If the encoded point is invalid in any waypublic static byte[] encodePointNoAsn(ECPoint point, EllipticCurve curve)
point - The ECPoint to convertcurve - The curve on which the point residespublic static byte[] encodePoint(ECPoint point, EllipticCurve curve)
point - The ECPoint to convertcurve - The curve on which the point residespublic static boolean isCompressed(byte[] point)
point - The encoded pointpublic static String getCurveName(ECParameterSpec params)
params - The EC parameter spec to examinepublic static String getCurveCommonName(ECParameterSpec params)
params - The EC parameter spec to examinepublic static BigInteger bi(String s)
s - String representation of a hexadecimal numberpublic static int getFieldSize(ECParameterSpec spec)
spec - the JCA specification objectpublic static int getRawSignatureSize(ECKey key)
key will
have the same signature size.
Note that the final ECDSA signature will include ASN.1 encoding which is not figured into this total.
key - the key to analyzeCopyright 2014-2016 SafeNet Inc