public final class ECUtil
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static java.security.interfaces.ECPrivateKey |
checkPrivateKey(java.security.interfaces.ECPrivateKey prv)
Check an ECPrivateKey to make sure the scalar value is within the
range of the order [1, n-1].
|
static java.security.interfaces.ECPrivateKey |
decodePKCS8ECPrivateKey(byte[] encoded) |
static java.security.spec.ECPoint |
decodePoint(byte[] data,
java.security.spec.EllipticCurve curve) |
static byte[] |
decodeSignature(byte[] sig) |
static java.security.interfaces.ECPublicKey |
decodeX509ECPublicKey(byte[] encoded) |
static byte[] |
encodeECParameterSpec(java.security.Provider p,
java.security.spec.ECParameterSpec spec) |
static byte[] |
encodePoint(java.security.spec.ECPoint point,
java.security.spec.EllipticCurve curve) |
static byte[] |
encodeSignature(byte[] signature) |
static boolean |
equals(java.security.spec.ECParameterSpec spec1,
java.security.spec.ECParameterSpec spec2) |
static java.security.interfaces.ECPrivateKey |
generateECPrivateKey(java.math.BigInteger s,
java.security.spec.ECParameterSpec params) |
static java.lang.String |
getCurveName(java.security.Provider p,
java.security.spec.ECParameterSpec spec) |
static java.security.AlgorithmParameters |
getECParameters(java.security.Provider p) |
static java.security.spec.ECParameterSpec |
getECParameterSpec(java.security.Provider p,
byte[] params) |
static java.security.spec.ECParameterSpec |
getECParameterSpec(java.security.Provider p,
java.security.spec.ECParameterSpec spec) |
static java.security.spec.ECParameterSpec |
getECParameterSpec(java.security.Provider p,
int keySize) |
static java.security.spec.ECParameterSpec |
getECParameterSpec(java.security.Provider p,
java.lang.String name) |
static byte[] |
sArray(java.math.BigInteger s,
java.security.spec.ECParameterSpec params) |
static byte[] |
trimZeroes(byte[] b) |
static void |
validatePublicKey(java.security.spec.ECPoint point,
java.security.spec.ECParameterSpec spec) |
static byte[] |
x509EncodeECPublicKey(java.security.spec.ECPoint w,
java.security.spec.ECParameterSpec params) |
public static byte[] sArray(java.math.BigInteger s,
java.security.spec.ECParameterSpec params)
public static java.security.spec.ECPoint decodePoint(byte[] data,
java.security.spec.EllipticCurve curve)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] encodePoint(java.security.spec.ECPoint point,
java.security.spec.EllipticCurve curve)
public static byte[] trimZeroes(byte[] b)
public static java.security.interfaces.ECPublicKey decodeX509ECPublicKey(byte[] encoded)
throws java.security.spec.InvalidKeySpecException
java.security.spec.InvalidKeySpecExceptionpublic static byte[] x509EncodeECPublicKey(java.security.spec.ECPoint w,
java.security.spec.ECParameterSpec params)
throws java.security.spec.InvalidKeySpecException
java.security.spec.InvalidKeySpecExceptionpublic static java.security.interfaces.ECPrivateKey decodePKCS8ECPrivateKey(byte[] encoded)
throws java.security.spec.InvalidKeySpecException
java.security.spec.InvalidKeySpecExceptionpublic static java.security.interfaces.ECPrivateKey generateECPrivateKey(java.math.BigInteger s,
java.security.spec.ECParameterSpec params)
throws java.security.spec.InvalidKeySpecException
java.security.spec.InvalidKeySpecExceptionpublic static java.security.AlgorithmParameters getECParameters(java.security.Provider p)
public static byte[] encodeECParameterSpec(java.security.Provider p,
java.security.spec.ECParameterSpec spec)
public static java.security.spec.ECParameterSpec getECParameterSpec(java.security.Provider p,
java.security.spec.ECParameterSpec spec)
public static java.security.spec.ECParameterSpec getECParameterSpec(java.security.Provider p,
byte[] params)
throws java.io.IOException
java.io.IOExceptionpublic static java.security.spec.ECParameterSpec getECParameterSpec(java.security.Provider p,
java.lang.String name)
public static java.security.spec.ECParameterSpec getECParameterSpec(java.security.Provider p,
int keySize)
public static java.lang.String getCurveName(java.security.Provider p,
java.security.spec.ECParameterSpec spec)
public static boolean equals(java.security.spec.ECParameterSpec spec1,
java.security.spec.ECParameterSpec spec2)
public static byte[] encodeSignature(byte[] signature)
throws java.security.SignatureException
java.security.SignatureExceptionpublic static byte[] decodeSignature(byte[] sig)
throws java.security.SignatureException
java.security.SignatureExceptionpublic static java.security.interfaces.ECPrivateKey checkPrivateKey(java.security.interfaces.ECPrivateKey prv)
throws java.security.InvalidKeyException
prv - the private key to be checked.java.security.InvalidKeyException - if the key's scalar value is not within
the range 1 <= x < n where n is the order of the generator.public static void validatePublicKey(java.security.spec.ECPoint point,
java.security.spec.ECParameterSpec spec)
throws java.security.InvalidKeyException
java.security.InvalidKeyException