Documentation
¶
Index ¶
- func Clear(b []byte)
- func NewVaultKeyProvider(conf VaultConfig) (stream.KeyProvider, error)
- type AESConfig
- type AESCryptor
- type Coder
- type CompressionConfig
- type Compressor
- type Config
- type Cryptor
- func NewGPGCryptor(publicKey, privateKey io.Reader, password []byte) (Cryptor, error)
- func NewGPGCryptorFile(publicKeyPath, privateKeyPath string, password []byte) (Cryptor, error)
- func NewGPGDecryptor(data io.Reader, password []byte) (Cryptor, error)
- func NewGPGDecryptorFile(path string, password []byte) (Cryptor, error)
- func NewGPGEncryptor(data io.Reader) (Cryptor, error)
- func NewGPGEncryptorFile(path string) (Cryptor, error)
- func NoEncryption() Cryptor
- type EncodingConfig
- type EncryptionConfig
- type FS
- func (fsys *FS) Disfigure(plaintext []byte) ([]byte, error)
- func (fsys *FS) Open(name string) (fs.File, error)
- func (fsys *FS) ReadFile(name string) ([]byte, error)
- func (fsys *FS) Reveal(encodedBytes []byte) ([]byte, error)
- func (fsys *FS) SetCoder(coder Coder)
- func (fsys *FS) SetCompression(compressor Compressor)
- func (fsys *FS) SetHMACKey(key []byte)
- func (fsys *FS) WriteFile(filepath string, plaintext []byte, perm fs.FileMode) error
- type GPGConfig
- type GPGCryptor
- type GzipConfig
- type KubernetesConfig
- type TokenConfig
- type VaultConfig
- type VaultCryptor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Clear ¶ added in v0.12.0
func Clear(b []byte)
Clear overwrites every byte of b with zero, for a caller clearing a key or plaintext they own.
Prefer it to the clear builtin. A clear(b) with no later read of b is a dead store the compiler may remove; Clear is not inlined and keeps b reachable until the write is done, so the write happens.
cryptfs copies keys you pass in (AES, HMAC, stream static keys, GPG password). Clearing your slice after NewAESCryptor, SetHMACKey, or NewStaticKeyProvider does not affect the FS. Call Clear on buffers you own when you are done with them.
Clear zeroes len(b) bytes. To clear a slice's full backing array, pass b[:cap(b)]. It is best-effort heap hygiene: it does not reach copies in CPU registers or on the stack, key schedules held by crypto/cipher, or strings.
func NewVaultKeyProvider ¶ added in v0.11.0
func NewVaultKeyProvider(conf VaultConfig) (stream.KeyProvider, error)
Types ¶
type AESCryptor ¶
type AESCryptor struct {
// contains filtered or unexported fields
}
func NewAESCryptor ¶
func NewAESCryptor(key []byte) (*AESCryptor, error)
NewAESCryptor returns an Cryptor which performs AES encryption/decryption.
The key must be 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.
type Coder ¶
type Coder interface {
// contains filtered or unexported methods
}
Coder is an interface describing two operations which transform data into another format. This can be done to compress or disfigure bytes.
func Base64 ¶
func Base64() Coder
Base64 is a Coder which transforms data following RFC 4648 section 3.2. There are no padding characters added or accepted by this Coder.
type CompressionConfig ¶ added in v0.6.0
type CompressionConfig struct {
Gzip *GzipConfig `json:"gzip" yaml:"gzip"`
}
type Compressor ¶ added in v0.5.0
type Compressor interface {
// contains filtered or unexported methods
}
func Gzip ¶ added in v0.5.0
func Gzip() Compressor
Gzip returns a Compressor using DefaultCompression.
func GzipLevel ¶ added in v0.5.0
func GzipLevel(level int) Compressor
GzipLevel returns a Compressor with the specified level.
func GzipRequired ¶ added in v0.5.0
func GzipRequired(level int) Compressor
GzipRequired returns a Compressor that rejects non-gzipped input.
func NoCompression ¶ added in v0.5.0
func NoCompression() Compressor
type Config ¶ added in v0.6.0
type Config struct {
Compression CompressionConfig `json:"compression" yaml:"compression"`
Encryption EncryptionConfig `json:"encryption" yaml:"encryption"`
Encoding EncodingConfig `json:"encoding" yaml:"encoding"`
HMACKey string `json:"hmacKey" yaml:"hmacKey"`
}
type Cryptor ¶
type Cryptor interface {
// contains filtered or unexported methods
}
func NewGPGCryptor ¶ added in v0.4.0
func NewGPGCryptorFile ¶ added in v0.4.0
func NewGPGDecryptor ¶ added in v0.4.0
func NewGPGDecryptorFile ¶ added in v0.4.0
func NewGPGEncryptorFile ¶ added in v0.4.0
func NoEncryption ¶ added in v0.6.0
func NoEncryption() Cryptor
type EncodingConfig ¶ added in v0.6.0
type EncodingConfig struct {
Base64 bool `json:"base64" yaml:"base64"`
}
type EncryptionConfig ¶ added in v0.6.0
type EncryptionConfig struct {
AES *AESConfig `json:"aes" yaml:"aes"`
GPG *GPGConfig `json:"gpg" yaml:"gpg"`
Vault *VaultConfig `json:"vault" yaml:"vault"`
}
type FS ¶
type FS struct {
// contains filtered or unexported fields
}
func FromConfig ¶ added in v0.6.0
FromConfig will create a *FS from the given Config
func FromCryptor ¶
FromCryptor returns an FS instance and allows passing the results of creating a Cryptor directly as the arguments.
func New ¶
New returns a FS instance with the specified Cryptor used for all operations.
Note: The defaults are to use no compression and no encryption.
func (*FS) Open ¶
Open opens the named file on the local filesystem. It does not decrypt. The returned file is the stored bytes (ciphertext if the file was written with WriteFile). Use ReadFile or Reveal to decrypt.
func (*FS) SetCompression ¶ added in v0.5.0
func (fsys *FS) SetCompression(compressor Compressor)
func (*FS) SetHMACKey ¶ added in v0.8.0
type GPGCryptor ¶ added in v0.4.0
type GPGCryptor struct {
// contains filtered or unexported fields
}
type GzipConfig ¶ added in v0.6.0
type KubernetesConfig ¶ added in v0.7.0
type KubernetesConfig struct {
Path string `json:"path" yaml:"path"`
}
type TokenConfig ¶ added in v0.7.0
type TokenConfig struct {
Token string `json:"token" yaml:"token"`
}
type VaultConfig ¶ added in v0.7.0
type VaultConfig struct {
Address string `json:"address" yaml:"address"`
Token *TokenConfig `json:"token" yaml:"token"`
Kubernetes *KubernetesConfig `json:"kubernetes" yaml:"kubernetes"`
// KeyName is the named transit key to use
KeyName string `json:"keyName" yaml:"keyName"`
}
type VaultCryptor ¶ added in v0.7.0
type VaultCryptor struct {
// contains filtered or unexported fields
}
func NewVaultCryptor ¶ added in v0.7.0
func NewVaultCryptor(conf VaultConfig) (*VaultCryptor, error)
