crypt

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: EUPL-1.2 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecryptFromStdin

func DecryptFromStdin(privateKeys []string, paasName string) error

func EncryptFile

func EncryptFile(publicKey string, paasName string, path string) error

func EncryptFromStdin

func EncryptFromStdin(publicKey string, paasName string) error

func GenerateKeyPair

func GenerateKeyPair(privateKey string, publicKey string) error

Types

type Crypt

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

func NewCryptFromFiles added in v1.3.0

func NewCryptFromFiles(privateKeyPaths []string, publicKeyPath string, encryptionContext string) (*Crypt, error)

NewCryptFromFiles returns a Crypt based on the provided privateKeyPaths and publicKeyPath using the encryptionContext

func NewCryptFromKeys added in v1.3.0

func NewCryptFromKeys(privateKeys CryptPrivateKeys, publicKeyPath string, encryptionContext string) (*Crypt, error)

NewCryptFromKeys returns a Crypt based on the provided privateKeys and publicKey using the encryptionContext

func NewGeneratedCrypt added in v0.6.1

func NewGeneratedCrypt(privateKeyPath string, publicKeyPath string) (*Crypt, error)

func (Crypt) Decrypt

func (c Crypt) Decrypt(b64 string) ([]byte, error)

func (*Crypt) DecryptRsa

func (c *Crypt) DecryptRsa(data []byte) (decryptedBytes []byte, err error)

func (*Crypt) Encrypt

func (c *Crypt) Encrypt(secret []byte) (encrypted string, err error)

func (*Crypt) EncryptRsa

func (c *Crypt) EncryptRsa(secret []byte) (encryptedBytes []byte, err error)

type CryptPrivateKey added in v1.3.0

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

A CryptPrivateKey is used for decryption of encrypted secrets

func NewPrivateKeyFromFile added in v1.3.0

func NewPrivateKeyFromFile(privateKeyPath string) (*CryptPrivateKey, error)

NewPrivateKeyFromFile returns a CryptPrivateKey from a privateKeyFilePath

func NewPrivateKeyFromPem added in v1.3.0

func NewPrivateKeyFromPem(privateKeyPath string, privateKeyPem []byte) (*CryptPrivateKey, error)

NewPrivateKeyFromPem returns a CryptPrivateKey from a privateKeyFilePath

func (*CryptPrivateKey) DecryptRsa added in v1.3.0

func (pk *CryptPrivateKey) DecryptRsa(data []byte, encryptionContext []byte) (decryptedBytes []byte, err error)

type CryptPrivateKeys added in v1.3.0

type CryptPrivateKeys []*CryptPrivateKey

We can use multiple private keys (for rotation) and store them in a list of PrivateKey's

func NewPrivateKeysFromFiles added in v1.3.0

func NewPrivateKeysFromFiles(privateKeyPaths []string) (CryptPrivateKeys, error)

NewPrivateKeysFromFiles returns a Crypt based on the provided privateKeyPaths

func NewPrivateKeysFromSecretData added in v1.3.0

func NewPrivateKeysFromSecretData(privateKeyData map[string][]byte) (CryptPrivateKeys, error)

NewPrivateKeysFromSecretData returns a Crypt based on the provided privateKeyPaths

func (CryptPrivateKeys) AsSecretData added in v1.3.0

func (pks CryptPrivateKeys) AsSecretData() (data map[string][]byte)

func (CryptPrivateKeys) Compare added in v1.3.0

func (pks CryptPrivateKeys) Compare(other CryptPrivateKeys) (same bool)

Compare checks 2 sets of private keys

Jump to

Keyboard shortcuts

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