public static interface SecureMemory.Native
| Modifier and Type | Method and Description |
|---|---|
com.sun.jna.Pointer |
sodiumAllocArray(int count,
int size)
Returns a pointer from which
count objects that are size bytes of memory each can be accessed.
|
void |
sodiumFree(com.sun.jna.Pointer p)
Unlocks and deallocates memory allocated using
sodiumMalloc(int) or sodiumAllocArray(int, int)}. |
com.sun.jna.Pointer |
sodiumMalloc(int size)
Returns a pointer from which exactly
size contiguous bytes of memory can be accessed.
|
boolean |
sodiumMemZero(byte[] pnt,
int len)
The sodium_memzero() function tries to effectively zero len bytes starting at pnt,
even if optimizations are being applied to the code.
|
boolean |
sodiumMLock(byte[] array,
int len)
Locks at least len bytes of memory from the array.
|
boolean |
sodiumMProtectNoAccess(com.sun.jna.Pointer ptr)
Makes a region allocated using
sodiumMalloc(int) or sodiumAllocArray(int, int)}
inaccessible. |
boolean |
sodiumMProtectReadOnly(com.sun.jna.Pointer ptr)
Marks a region allocated using
sodiumMalloc(int) or sodiumAllocArray(int, int)}
as read-only. |
boolean |
sodiumMProtectReadWrite(com.sun.jna.Pointer ptr)
Marks a region allocated using
sodiumMalloc(int) or sodiumAllocArray(int, int)}
as readable and writable, after having been protected using
sodiumMProtectReadOnly(Pointer) or sodiumMProtectNoAccess(Pointer)}/ |
boolean |
sodiumMUnlock(byte[] array,
int len)
Unlocks at least len bytes of memory from the array.
|
boolean sodiumMemZero(byte[] pnt,
int len)
pnt - The byte array to zero out.len - How many bytes to zero out.boolean sodiumMLock(byte[] array,
int len)
array - Array to lock.len - Number of bytes to lock.boolean sodiumMUnlock(byte[] array,
int len)
array - Array to unlock.len - Number of bytes to unlock.com.sun.jna.Pointer sodiumMalloc(int size)
size - The size of the byte array to allocate.com.sun.jna.Pointer sodiumAllocArray(int count,
int size)
sodiumMalloc(int) but
also protects against arithmetic overflows when count * size exceeds SIZE_MAX.count - Number of objectssize - Size of those objectsvoid sodiumFree(com.sun.jna.Pointer p)
sodiumMalloc(int) or sodiumAllocArray(int, int)}.p - The pointer to which an array shall be freed.boolean sodiumMProtectNoAccess(com.sun.jna.Pointer ptr)
sodiumMalloc(int) or sodiumAllocArray(int, int)}
inaccessible. It cannot be read or written, but the data is preserved.ptr - The pointer to a region to decline access to.boolean sodiumMProtectReadOnly(com.sun.jna.Pointer ptr)
sodiumMalloc(int) or sodiumAllocArray(int, int)}
as read-only.
Attempting to modify the data will cause the process to terminate.ptr - Pointer to the region.boolean sodiumMProtectReadWrite(com.sun.jna.Pointer ptr)
sodiumMalloc(int) or sodiumAllocArray(int, int)}
as readable and writable, after having been protected using
sodiumMProtectReadOnly(Pointer) or sodiumMProtectNoAccess(Pointer)}/ptr - Pointer to the region.