security

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ZeroAliceDkgOutput

func ZeroAliceDkgOutput(out *dkg.AliceOutput)

ZeroAliceDkgOutput zeroes sensitive fields in an AliceOutput. Call this after persisting the output to BadgerDB.

func ZeroBobDkgOutput

func ZeroBobDkgOutput(out *dkg.BobOutput)

ZeroBobDkgOutput zeroes sensitive fields in a BobOutput.

func ZeroBytes

func ZeroBytes(data []byte)

ZeroBytes securely zeros out a byte slice to prevent sensitive data from remaining in memory. This uses explicit memory zeroing and garbage collection to help ensure the data is actually cleared.

func ZeroScalar

func ZeroScalar(s curves.Scalar)

ZeroScalar zeroes a kryptology Scalar by replacing its value with the field's zero element. Safe to call with nil.

func ZeroString

func ZeroString(s *string)

ZeroString securely clears a string reference and encourages garbage collection. Note: Go strings are immutable, so we can only clear the reference and rely on GC. This provides best-effort security by clearing the reference and forcing GC.

Types

type SecureBytes

type SecureBytes struct {
	// contains filtered or unexported fields
}

SecureBytes is a wrapper for sensitive byte data that automatically zeros itself when no longer needed

func NewSecureBytes

func NewSecureBytes(data []byte) *SecureBytes

NewSecureBytes creates a new SecureBytes instance

func (*SecureBytes) Bytes

func (sb *SecureBytes) Bytes() []byte

Bytes returns the underlying byte slice (use with caution)

func (*SecureBytes) Clear

func (sb *SecureBytes) Clear()

Clear explicitly zeros the data and removes the finalizer

func (*SecureBytes) Copy

func (sb *SecureBytes) Copy() []byte

Copy returns a copy of the data

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL