class Sodium::SecureBuffer
- Sodium::SecureBuffer
- Reference
- Object
Overview
Allocate guarded memory using sodium_malloc
initialize returns readonly or readwrite for thread safety
When state changes are required (such as using #noaccess) and the buffer is accessed from multiple threads wrap each #readonly/#readwrite block in a lock.
Included Modules
- Crypto::Secret::Stateful
Extended Modules
- Crypto::Secret::ClassMethods
Defined in:
sodium/secure_buffer.crConstructors
- .new(bytesize : Int32)
-
.new(bytes : Bytes, erase = false)
Copies bytes to a readonly SecureBuffer.
Instance Method Summary
- #bytesize : Int32
-
#to_slice : Bytes
Returns key May permanently set key to readonly depending on class usage.
DEPRECATED Use the Slice provided within a
readonly
orreadwrite
block
Constructor Detail
def self.new(bytes : Bytes, erase = false)
#
Copies bytes to a readonly SecureBuffer. Optionally erases bytes after copying if erase is set Returns a readonly SecureBuffer.
Instance Method Detail
def to_slice : Bytes
#
Returns key May permanently set key to readonly depending on class usage. WARNING: Not thread safe unless this object is readonly or readwrite
DEPRECATED Use the Slice provided within a readonly
or readwrite
block