Class Ecc

java.lang.Object

public class Ecc
extends NativeStruct
Wrapper for the native WolfCrypt ecc implementation.
Version:
2.0, February 2017
Author:
Moisés Guimarães
  • 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 class NativeStruct
    • mallocNativeStruct

      protected long mallocNativeStruct() throws java.lang.OutOfMemoryError
      Specified by:
      mallocNativeStruct in class NativeStruct
      Throws:
      java.lang.OutOfMemoryError
    • init

      protected void init()
    • free

      protected void free()
    • makeKey

      public void makeKey​(Rng rng, int size)
    • makeKeyOnCurve

      public void makeKeyOnCurve​(Rng rng, int size, java.lang.String curveName)
    • 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

      public byte[] makeSharedSecret​(Ecc pubKey)
    • sign

      public byte[] sign​(byte[] hash, Rng rng)
    • 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