Documentation
¶
Index ¶
- func Decrypt(encryptedBase64 string, key []byte) (string, error)
- func DecryptFile(sourceFilePath string, targetFilePath string, key []byte) error
- func DecryptFromFile(inputFilePath string, key []byte) (string, error)
- func DecryptFromReader(reader io.Reader, key []byte) (string, error)
- func DecryptStdin(key []byte) (string, error)
- func DecryptToFile(input string, outputFilePath string, key []byte, append bool) error
- func Encrypt(input string, key []byte) (string, error)
- func EncryptFile(sourceFilePath string, targetFilePath string, key []byte) error
- func EncryptFromFile(inputFilePath string, key []byte) (string, error)
- func EncryptFromReader(reader io.Reader, key []byte) (string, error)
- func EncryptStdin(key []byte) (string, error)
- func EncryptToBytes(input string, key []byte) ([]byte, error)
- func EncryptToFile(input string, outputFilePath string, key []byte, append bool) error
- type KeyManager
- type SecureKVStore
- func (s *SecureKVStore) Clear()
- func (s *SecureKVStore) Delete(key string)
- func (s *SecureKVStore) Get(key string) (string, error)
- func (s *SecureKVStore) Len() int
- func (s *SecureKVStore) ListKeys() []string
- func (s *SecureKVStore) MatchValue(value string) bool
- func (s *SecureKVStore) Put(key, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptFile ¶
Read from a source text file, decrypt, and write to a target file
func DecryptFromFile ¶
Decrypt data read from a text file
func DecryptFromReader ¶ added in v1.1.0
DecryptFromReader decrypts data read from an io.Reader.
func DecryptToFile ¶
Decrypt an input string to a file, with an option to append or overwrite
func EncryptFile ¶
Read from a source text file, encrypt, and write to a target file
func EncryptFromFile ¶
Encrypt data read from a text file
func EncryptFromReader ¶ added in v1.1.0
EncryptFromReader encrypts data read from an io.Reader.
Types ¶
type KeyManager ¶ added in v1.1.0
type KeyManager struct {
// contains filtered or unexported fields
}
KeyManager stores encryption keys externally
func NewKeyManager ¶ added in v1.1.0
func NewKeyManager() *KeyManager
NewKeyManager initializes an external key manager
func (*KeyManager) DeleteKey ¶ added in v1.1.0
func (km *KeyManager) DeleteKey(id string)
DeleteKey removes a key from the key manager
func (*KeyManager) GenerateKey ¶ added in v1.1.0
func (km *KeyManager) GenerateKey(id string) ([]byte, error)
GenerateKey creates a new AES-256 key
type SecureKVStore ¶ added in v1.1.0
type SecureKVStore struct {
// contains filtered or unexported fields
}
SecureKVStore is an in-memory encrypted key-value store
func NewSecureKVStore ¶ added in v1.1.0
func NewSecureKVStore(km *KeyManager) *SecureKVStore
NewSecureKVStore initializes a new secure in-memory store
func (*SecureKVStore) Clear ¶ added in v1.1.0
func (s *SecureKVStore) Clear()
Clear removes all values from the store
func (*SecureKVStore) Delete ¶ added in v1.1.0
func (s *SecureKVStore) Delete(key string)
Delete removes a key from the store
func (*SecureKVStore) Get ¶ added in v1.1.0
func (s *SecureKVStore) Get(key string) (string, error)
Get retrieves and decrypts a value from memory
func (*SecureKVStore) Len ¶ added in v1.1.0
func (s *SecureKVStore) Len() int
func (*SecureKVStore) ListKeys ¶ added in v1.1.0
func (s *SecureKVStore) ListKeys() []string
func (*SecureKVStore) MatchValue ¶ added in v1.1.0
func (s *SecureKVStore) MatchValue(value string) bool
func (*SecureKVStore) Put ¶ added in v1.1.0
func (s *SecureKVStore) Put(key, value string) error
Put securely stores an encrypted key-value pair in memory