class Sodium::SecureBuffer
- Sodium::SecureBuffer
- Reference
- Object
Overview
Allocate guarded memory using sodium_malloc
Defined in:
sodium/secure_buffer.crConstructors
- .new(bytesize : Int32)
-
.new(bytes : Bytes, erase = false)
Copies bytes to a readonly SecureBuffer.
Class Method Summary
-
.random(size)
Returns a readonly random SecureBuffer.
Instance Method Summary
- #+(*args, **options)
- #+(*args, **options, &)
-
#==(other : Bytes)
Timing safe memory compare.
-
#==(other : self)
Timing safe memory compare.
- #[](*args, **options)
- #[](*args, **options, &)
- #[]=(*args, **options)
- #bytesize : Int32
-
#dup
Returns a shallow copy of this object.
- #finalize
-
#noaccess
Makes a region allocated using sodium_malloc() or sodium_allocarray() inaccessible.
-
#readonly(&)
Temporarily make buffer readonly within the block returning to the prior state on exit.
-
#readonly
Marks a region allocated using sodium_malloc() or sodium_allocarray() as read-only.
-
#readwrite(&)
Temporarily make buffer readonly within the block returning to the prior state on exit.
-
#readwrite
Marks a region allocated using sodium_malloc() or sodium_allocarray() as readable and writable, after having been protected using sodium_mprotect_readonly() or sodium_mprotect_noaccess().
-
#to_slice : Bytes
Returns key May permanently set key to readonly depending on class usage.
- #to_unsafe : Pointer(UInt8)
- #wipe(&)
- #wipe
Constructor Detail
Copies bytes to a readonly SecureBuffer. Optionally erases bytes after copying if erase is set
Class Method Detail
Instance Method Detail
Returns a shallow copy of this object.
This allocates a new object and copies the contents of
self
into it.
Makes a region allocated using sodium_malloc() or sodium_allocarray() inaccessible. It cannot be read or written, but the data are preserved.
Temporarily make buffer readonly within the block returning to the prior state on exit.
Temporarily make buffer readonly within the block returning to the prior state on exit.
Marks a region allocated using sodium_malloc() or sodium_allocarray() as readable and writable, after having been protected using sodium_mprotect_readonly() or sodium_mprotect_noaccess().