Package com.wolfssl.wolfcrypt
Class Rsa
java.lang.Object
com.wolfssl.wolfcrypt.WolfObject
com.wolfssl.wolfcrypt.NativeStruct
com.wolfssl.wolfcrypt.Rsa
public class Rsa extends NativeStruct
Wrapper for the native WolfCrypt Rsa implementation.
- Version:
- 2.0, March 2017
- Author:
- Moisés Guimarães
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
decodePrivateKey(byte[] key)
void
decodePrivateKeyPKCS8(byte[] key)
void
decodePublicKey(byte[] key)
void
decodeRawPublicKey(byte[] n, byte[] e)
void
decodeRawPublicKey(byte[] n, long nSize, byte[] e, long eSize)
void
decodeRawPublicKey(java.nio.ByteBuffer n, long nSz, java.nio.ByteBuffer e, long eSz)
void
decodeRawPublicKey(java.nio.ByteBuffer n, java.nio.ByteBuffer e)
byte[]
decrypt(byte[] ciphertext)
byte[]
encrypt(byte[] plain, Rng rng)
void
exportRawPublicKey(byte[] n, long[] nSz, byte[] e, long[] eSz)
void
exportRawPublicKey(java.nio.ByteBuffer n, java.nio.ByteBuffer e)
protected void
free()
int
getEncryptSize()
protected void
init()
void
makeKey(int size, long e, Rng rng)
protected long
mallocNativeStruct()
void
releaseNativeStruct()
Releases the host data stored in a NativeStruct.void
setRng(Rng rng)
byte[]
sign(byte[] data, Rng rng)
byte[]
verify(byte[] signature)
protected void
willSetKey()
protected void
willUseKey(boolean priv)
Methods inherited from class com.wolfssl.wolfcrypt.NativeStruct
finalize, getNativeStruct, setNativeStruct
-
Constructor Details
-
Method Details
-
mallocNativeStruct
protected long mallocNativeStruct() throws java.lang.OutOfMemoryError- Specified by:
mallocNativeStruct
in classNativeStruct
- Throws:
java.lang.OutOfMemoryError
-
setRng
-
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
-
init
protected void init() -
willSetKey
protected void willSetKey() -
willUseKey
protected void willUseKey(boolean priv) -
free
protected void free() -
makeKey
-
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
-
decrypt
public byte[] decrypt(byte[] ciphertext) -
sign
-
verify
public byte[] verify(byte[] signature)
-