xsecurity

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptWithPrivateKey

func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey, xhash hash.Hash) ([]byte, error)

func EncryptWithPublicKey

func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey, xhash hash.Hash) ([]byte, error)

func LoadPrivateKey

func LoadPrivateKey(xpath string) (*rsa.PrivateKey, error)

Types

type EncryptionAES

type EncryptionAES struct {
	Key []byte // Must be 32 bytes for AES-256
}

func NewEncryptionAES

func NewEncryptionAES(key []byte) (*EncryptionAES, error)

NewEncryptionAES creates a new instance with the given key (must be 32 bytes)

func (*EncryptionAES) Decrypt

func (e *EncryptionAES) Decrypt(encoded string, key ...string) (string, error)

Decrypt takes base64(nonce + tag + ciphertext) and returns plaintext

func (*EncryptionAES) Encrypt

func (e *EncryptionAES) Encrypt(plaintext string, key ...string) (string, error)

Encrypt returns base64(nonce + tag + ciphertext)

Jump to

Keyboard shortcuts

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