Documentation
¶
Overview ¶
Package crypt provides encryption writer/readers.
Index ¶
- type Crypt
- func (cr *Crypt) DecryptLookupField(field string) (string, error)
- func (cr *Crypt) EncryptLookupField(field string) (string, error)
- func (cr *Crypt) Key() *charm.EncryptKey
- func (cr *Crypt) NewDecryptedReader(r io.Reader) (*DecryptedReader, error)
- func (cr *Crypt) NewEncryptedWriter(w io.Writer) (*EncryptedWriter, error)
- type DecryptedReader
- type EncryptedWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Crypt ¶
type Crypt struct {
// contains filtered or unexported fields
}
Crypt manages the account and encryption keys used for encrypting and decrypting.
func NewCrypt ¶
NewCrypt authenticates a user to the Charm Cloud and returns a Crypt struct ready for encrypting and decrypting.
func NewCryptWithKey ¶
func NewCryptWithKey(ek *charm.EncryptKey) *Crypt
NewCryptWithKey creates a new Crypt with a specific EncryptKey.
func (*Crypt) DecryptLookupField ¶
DecryptLookupField decrypts a string encrypted with EncryptLookupField.
func (*Crypt) EncryptLookupField ¶
EncryptLookupField will deterministically encrypt a string and the same encrypted value every time this string is encrypted with the same EncryptKey. This is useful if you need to look up an encrypted value without knowing the plaintext on the storage side. For writing encrypted data, use EncrytpedWriter which is non-deterministic.
func (*Crypt) Key ¶
func (cr *Crypt) Key() *charm.EncryptKey
Key returns the EncryptKey this Crypt is using.
func (*Crypt) NewDecryptedReader ¶
func (cr *Crypt) NewDecryptedReader(r io.Reader) (*DecryptedReader, error)
NewDecryptedReader creates a new Reader that will read from and decrypt the passed in io.Reader of encrypted data.
func (*Crypt) NewEncryptedWriter ¶
func (cr *Crypt) NewEncryptedWriter(w io.Writer) (*EncryptedWriter, error)
NewEncryptedWriter creates a new Writer that encrypts all data and writes the encrypted data to the supplied io.Writer.
type DecryptedReader ¶
type DecryptedReader struct {
// contains filtered or unexported fields
}
DecryptedReader is an io.Reader that decrypts data from an encrypted underlying io.Reader.
type EncryptedWriter ¶
type EncryptedWriter struct {
// contains filtered or unexported fields
}
EncryptedWriter is an io.WriteCloser. All data written to this writer is encrypted before being written to the underlying io.Writer.
func (*EncryptedWriter) Close ¶
func (ew *EncryptedWriter) Close() error
Close closes the underlying io.WriteCloser.