class Sodium::SecureBuffer

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

Extended Modules

Defined in:

sodium/secure_buffer.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(bytesize : Int32) #

[View source]
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.


[View source]

Instance Method Detail

def bytesize : Int32 #

[View source]
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


[View source]