class Sodium::SecureBuffer

Overview

Allocate guarded memory using sodium_malloc

Defined in:

sodium/secure_buffer.cr

Constructors

Class Method Summary

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


[View source]

Class Method Detail

def self.random(size) #

Returns a readonly random SecureBuffer.


[View source]

Instance Method Detail

def +(*args, **options) #

[View source]
def +(*args, **options, &) #

[View source]
def ==(other : Bytes) #

Timing safe memory compare.


[View source]
def ==(other : self) #

Timing safe memory compare.


[View source]
def [](*args, **options) #

[View source]
def [](*args, **options, &) #

[View source]
def []=(*args, **options) #

[View source]
def bytesize : Int32 #

[View source]
def dup #
Description copied from class Reference

Returns a shallow copy of this object.

This allocates a new object and copies the contents of self into it.


[View source]
def finalize #

[View source]
def noaccess #

Makes a region allocated using sodium_malloc() or sodium_allocarray() inaccessible. It cannot be read or written, but the data are preserved.


[View source]
def readonly(&) #

Temporarily make buffer readonly within the block returning to the prior state on exit.


[View source]
def readonly #

Marks a region allocated using sodium_malloc() or sodium_allocarray() as read-only.


[View source]
def readwrite(&) #

Temporarily make buffer readonly within the block returning to the prior state on exit.


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


[View source]
def to_slice : Bytes #

Returns key May permanently set key to readonly depending on class usage.


[View source]
def to_unsafe : Pointer(UInt8) #

[View source]
def wipe(&) #

[View source]
def wipe #

[View source]