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 voiddecodePrivateKey(byte[] key)voiddecodePrivateKeyPKCS8(byte[] key)voiddecodePublicKey(byte[] key)voiddecodeRawPublicKey(byte[] n, byte[] e)voiddecodeRawPublicKey(byte[] n, long nSize, byte[] e, long eSize)voiddecodeRawPublicKey(java.nio.ByteBuffer n, long nSz, java.nio.ByteBuffer e, long eSz)voiddecodeRawPublicKey(java.nio.ByteBuffer n, java.nio.ByteBuffer e)byte[]decrypt(byte[] ciphertext)byte[]encrypt(byte[] plain, Rng rng)voidexportRawPublicKey(byte[] n, long[] nSz, byte[] e, long[] eSz)voidexportRawPublicKey(java.nio.ByteBuffer n, java.nio.ByteBuffer e)protected voidfree()intgetEncryptSize()protected voidinit()voidmakeKey(int size, long e, Rng rng)protected longmallocNativeStruct()voidreleaseNativeStruct()Releases the host data stored in a NativeStruct.voidsetRng(Rng rng)byte[]sign(byte[] data, Rng rng)byte[]verify(byte[] signature)protected voidwillSetKey()protected voidwillUseKey(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:
mallocNativeStructin classNativeStruct- Throws:
java.lang.OutOfMemoryError
-
setRng
-
releaseNativeStruct
public void releaseNativeStruct()Description copied from class:NativeStructReleases 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:
releaseNativeStructin 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)
-