Package com.wolfssl.wolfcrypt
Class Ecc
java.lang.Object
com.wolfssl.wolfcrypt.WolfObject
com.wolfssl.wolfcrypt.NativeStruct
com.wolfssl.wolfcrypt.Ecc
public class Ecc extends NativeStruct
Wrapper for the native WolfCrypt ecc implementation.
- Version:
- 2.0, February 2017
- Author:
- Moisés Guimarães
-
Field Summary
-
Constructor Summary
Constructors Constructor Description Ecc()
-
Method Summary
Modifier and Type Method Description void
checkKey()
byte[]
exportPrivate()
byte[]
exportX963()
protected void
free()
static java.lang.String
getCurveName(java.security.spec.ECParameterSpec spec)
static int
getCurveSizeFromName(java.lang.String curveName)
void
importPrivate(byte[] privKey, byte[] x963Key)
void
importPrivateOnCurve(byte[] privKey, byte[] x963Key, java.lang.String curveName)
void
importX963(byte[] key)
protected void
init()
void
makeKey(Rng rng, int size)
void
makeKeyOnCurve(Rng rng, int size, java.lang.String curveName)
byte[]
makeSharedSecret(Ecc pubKey)
protected long
mallocNativeStruct()
void
privateKeyDecode(byte[] key)
byte[]
privateKeyEncode()
byte[]
privateKeyEncodePKCS8()
void
publicKeyDecode(byte[] key)
byte[]
publicKeyEncode()
void
releaseNativeStruct()
Releases the host data stored in a NativeStruct.byte[]
sign(byte[] hash, Rng rng)
boolean
verify(byte[] hash, byte[] signature)
Methods inherited from class com.wolfssl.wolfcrypt.NativeStruct
finalize, getNativeStruct, setNativeStruct
-
Constructor Details
-
Ecc
public Ecc()
-
-
Method Details
-
releaseNativeStruct
public void releaseNativeStruct()Description copied from class:NativeStruct
Releases the host data stored in a NativeStruct. This method provides a way to release host data without depending on the garbage collector to get around to releasing it. Derived objects whose native data structures have their own free functions, should be override this method to call that function.- Overrides:
releaseNativeStruct
in classNativeStruct
-
mallocNativeStruct
protected long mallocNativeStruct() throws java.lang.OutOfMemoryError- Specified by:
mallocNativeStruct
in classNativeStruct
- Throws:
java.lang.OutOfMemoryError
-
init
protected void init() -
free
protected void free() -
makeKey
-
makeKeyOnCurve
-
checkKey
public void checkKey() -
importPrivate
public void importPrivate(byte[] privKey, byte[] x963Key) -
importPrivateOnCurve
public void importPrivateOnCurve(byte[] privKey, byte[] x963Key, java.lang.String curveName) -
exportPrivate
public byte[] exportPrivate() -
importX963
public void importX963(byte[] key) -
exportX963
public byte[] exportX963() -
privateKeyDecode
public void privateKeyDecode(byte[] key) -
privateKeyEncode
public byte[] privateKeyEncode() -
publicKeyDecode
public void publicKeyDecode(byte[] key) -
publicKeyEncode
public byte[] publicKeyEncode() -
makeSharedSecret
-
sign
-
verify
public boolean verify(byte[] hash, byte[] signature) -
getCurveSizeFromName
public static int getCurveSizeFromName(java.lang.String curveName) -
privateKeyEncodePKCS8
public byte[] privateKeyEncodePKCS8() -
getCurveName
public static java.lang.String getCurveName(java.security.spec.ECParameterSpec spec) throws java.security.InvalidAlgorithmParameterException- Throws:
java.security.InvalidAlgorithmParameterException
-