security

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(ciphertext, key, iv []byte) ([]byte, error)

Perform AES-256-CBC decryption with PKCS#7 unpadding.

func DeriveKey

func DeriveKey(password string, salt []byte, iterations int) []byte

Derives a 32-byte AES key from a password and salt using PBKDF2-HMAC-SHA256.

func Encrypt

func Encrypt(plaintext, key, iv []byte) ([]byte, error)

Perform AES-256-CBC encryption with PKCS#7 padding.

func GenerateDeterministicRSAKeys

func GenerateDeterministicRSAKeys(sourceFile, password string) error

Writes "key.pem" using the sourceFile and password for entropy.

func GenerateRandomSalt

func GenerateRandomSalt() []byte

func GetKeyFromPEM

func GetKeyFromPEM(filename string) ([]byte, error)

Reads a PEM file, strips headers, and hashes the content to derive a 32-byte key.

Types

type DeterministicReader

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

func NewDeterministicReader

func NewDeterministicReader(seed []byte) (*DeterministicReader, error)

func (*DeterministicReader) Read

func (r *DeterministicReader) Read(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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