aged

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const AgePrivateKeyPattern = "^AGE-SECRET-KEY-1[A-Z0-9]{58}$"
View Source
const AgePublicKeyPattern = "^age1[a-z0-9]{58}$"
View Source
const ChunkSize = 64 * 1024

Variables

View Source
var ErrInvalidHeader = errors.New("invalid header")
View Source
var ErrInvalidHeaderLength = errors.New("invalid header length")
View Source
var ErrMissingFlag = errors.New("missing end flag")

Functions

func CheckPrivateKeyFormat added in v0.1.1

func CheckPrivateKeyFormat(key string) bool

func CheckPublicKeyFormat added in v0.1.1

func CheckPublicKeyFormat(key string) bool

func DecryptWithPwd

func DecryptWithPwd(p Parameters, pwd string) ([]byte, error)

func EncryptWithPwd

func EncryptWithPwd(p Parameters, pwd string) ([]byte, error)

func GenKeypair

func GenKeypair() (*age.X25519Identity, error)

func GenSecretKey added in v0.1.1

func GenSecretKey() (string, error)

Types

type AgeV1Obf

type AgeV1Obf struct{}

AgeV1Obf is a obfuscation for age encryption header.

func (*AgeV1Obf) Deobfuscate

func (a *AgeV1Obf) Deobfuscate(payload []byte) ([]byte, error)

func (*AgeV1Obf) Obfuscate

func (a *AgeV1Obf) Obfuscate(payload []byte) ([]byte, error)

type CustomObf added in v0.1.1

type CustomObf struct {
	Encoder func([]byte) ([]byte, error)
	Decoder func([]byte) ([]byte, error)
}

func (*CustomObf) Deobfuscate added in v0.1.1

func (c *CustomObf) Deobfuscate(payload []byte) ([]byte, error)

func (*CustomObf) Obfuscate added in v0.1.1

func (c *CustomObf) Obfuscate(payload []byte) ([]byte, error)

type Keychain

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

func SetupKeychain

func SetupKeychain(keychainSetup SetupKeychainParameters) (Keychain, error)

func (Keychain) Decrypt

func (k Keychain) Decrypt(p Parameters) ([]byte, error)

func (Keychain) Encrypt

func (k Keychain) Encrypt(p Parameters) ([]byte, error)

func (Keychain) KeychainExport

func (k Keychain) KeychainExport() []string

func (Keychain) KeychainExportSecretKey

func (k Keychain) KeychainExportSecretKey() string

type Obfuscation

type Obfuscation interface {
	Obfuscate([]byte) ([]byte, error)
	Deobfuscate([]byte) ([]byte, error)
}

Age keyslot header obfuscation

type Parameters

type Parameters struct {
	Data       []byte
	Compressor compression.Compressor
	Obfuscator Obfuscation
}

type Reader

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

func NewReader

func NewReader(key []byte, src io.Reader) (*Reader, error)

func (*Reader) Read

func (r *Reader) Read(p []byte) (int, error)

type SetupKeychainParameters

type SetupKeychainParameters struct {
	SecretKey     string
	PublicKeys    []string
	SelfRecipient bool
}

type Writer

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

func NewWriter

func NewWriter(key []byte, dst io.Writer) (*Writer, error)

func (*Writer) Close

func (w *Writer) Close() error

Close flushes the last chunk. It does not close the underlying Writer.

func (*Writer) Write

func (w *Writer) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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