Class Rsa

java.lang.Object

public class Rsa
extends NativeStruct
Wrapper for the native WolfCrypt Rsa implementation.
Version:
2.0, March 2017
Author:
Moisés Guimarães
  • Constructor Details

    • Rsa

      public Rsa()
    • Rsa

      public Rsa​(byte[] key)
    • Rsa

      public Rsa​(byte[] n, byte[] e)
  • Method Details

    • mallocNativeStruct

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

      public void setRng​(Rng rng)
    • 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
    • init

      protected void init()
    • willSetKey

      protected void willSetKey()
    • willUseKey

      protected void willUseKey​(boolean priv)
    • free

      protected void free()
    • makeKey

      public void makeKey​(int size, long e, Rng rng)
    • decodePublicKey

      public void decodePublicKey​(byte[] key)
    • decodePrivateKey

      public void decodePrivateKey​(byte[] key)
    • decodePrivateKeyPKCS8

      public void decodePrivateKeyPKCS8​(byte[] key)
    • decodeRawPublicKey

      public void decodeRawPublicKey​(byte[] n, byte[] e)
    • decodeRawPublicKey

      public void decodeRawPublicKey​(byte[] n, long nSize, byte[] e, long eSize)
    • decodeRawPublicKey

      public void decodeRawPublicKey​(java.nio.ByteBuffer n, java.nio.ByteBuffer e)
    • decodeRawPublicKey

      public void decodeRawPublicKey​(java.nio.ByteBuffer n, long nSz, java.nio.ByteBuffer e, long eSz)
    • exportRawPublicKey

      public void exportRawPublicKey​(byte[] n, long[] nSz, byte[] e, long[] eSz)
    • exportRawPublicKey

      public void exportRawPublicKey​(java.nio.ByteBuffer n, java.nio.ByteBuffer e)
    • getEncryptSize

      public int getEncryptSize()
    • encrypt

      public byte[] encrypt​(byte[] plain, Rng rng)
    • decrypt

      public byte[] decrypt​(byte[] ciphertext)
    • sign

      public byte[] sign​(byte[] data, Rng rng)
    • verify

      public byte[] verify​(byte[] signature)