Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 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