Documentation ¶
Index ¶
- Variables
- func CipherBytes(plaintext []byte, singleLine, disableValidation bool) (cipherBytes []byte)
- func CipherBytesFromPrimitives(plaintext []byte, singleLine, disableValidation bool, ...) (cipherBytes []byte)
- func CipherText(plaintext []byte, filepath string, singleLine, disableValidation bool) (err error)
- func PlainText(filepath string) (plaintext []byte, err error)
- func PlainTextFromBytes(cipherBytes []byte) (plaintext []byte, err error)
- func PlainTextFromPrimitives(cipherBytes []byte, ...) (plaintext []byte, err error)
- func Reencrypt(filepath string, singleLine, disableValidation bool) error
- type AwsKms
- type DecryptCommand
- type Defaults
- type EncryptCommand
- type GcpKms
- type KmsProvider
- type ReencryptCommand
Constants ¶
This section is empty.
Variables ¶
var ( //Parser is a new Parser with default options Parser = flags.NewParser(&defaultOptions, flags.Default) )
Functions ¶
func CipherBytes ¶
CipherBytes uses 'defaultOptions' go-flags to encrypt plaintext bytes and return ciphertext bytes
func CipherBytesFromPrimitives ¶
func CipherBytesFromPrimitives(plaintext []byte, singleLine, disableValidation bool, projectID, locationID, keyRingID, cryptoKeyID, keyName string, kmsProvider KmsProvider) (cipherBytes []byte)
CipherBytesFromPrimitives encrypts plaintext bytes and returns ciphertext bytes
func CipherText ¶
CipherText creates a ciphertext encrypted from a slice of bytes (the plaintext), and writes to File and Console.
func PlainTextFromBytes ¶
PlainTextFromBytes returns a slice of bytes (the plaintext), decrypted from a byte slice
func PlainTextFromPrimitives ¶
func PlainTextFromPrimitives(cipherBytes []byte, projectID, locationID, keyRingID, cryptoKeyID, keyName string, kmsProvider KmsProvider) (plaintext []byte, err error)
PlainTextFromPrimitives returns a slice of bytes (the plaintext), decrypted from a byte slice
Types ¶
type DecryptCommand ¶
type DecryptCommand struct { Filepath string `short:"f" long:"filepath" description:"Path of file to get encrypted string from" default:"./cipher.txt"` RetainCipherText bool `short:"r" long:"retainCipherText" description:"Retain ciphertext after decryption"` TargetFilepath string `short:"t" long:"targetFilepath" description:"Path of file to write decrypted string to" default:"./plain.txt"` Validate bool `short:"v" long:"validate" description:"Validate decryption works"` WriteToStdout bool `short:"o" long:"stdout" description:"Writes decrypted plaintext to console"` }
DecryptCommand type
func (*DecryptCommand) Execute ¶
func (x *DecryptCommand) Execute(args []string) error
Execute executes the DecryptCommand
type Defaults ¶
type Defaults struct { CryptoKeyID string `short:"c" long:"cryptokeyId" description:"Google KMS crytoKeyId" required:"false"` KeyRingID string `short:"k" long:"keyringId" description:"Google KMS keyRingId" required:"false"` KeyName string `short:"n" long:"keyName" description:"Google KMS keyName or AWS KMS keyId" required:"false"` LocationID string `short:"l" long:"locationId" description:"Google KMS locationId" required:"false"` ProjectID string `short:"p" long:"projectId" description:"Google projectId" required:"false"` KMSProvider string `short:"m" long:"kmsProvider" description:"KMS provider" required:"false"` }
Defaults type defining input flags
type EncryptCommand ¶
type EncryptCommand struct { DisableValidation bool `short:"d" long:"disableValidation" description:"Disable validation of ciphertext"` Filepath string `short:"f" long:"filepath" description:"Path of file to encrypt" default:"./plain.txt"` SingleLine bool `short:"s" long:"singleLine" description:"Disable use of newline chars in ciphertext"` }
EncryptCommand type
func (*EncryptCommand) Execute ¶
func (x *EncryptCommand) Execute(args []string) (err error)
Execute executes the EncryptCommand
type KmsProvider ¶
type KmsProvider interface {
// contains filtered or unexported methods
}
KmsProvider type
type ReencryptCommand ¶
type ReencryptCommand struct { DisableValidation bool `short:"d" long:"disableValidation" description:"Disable validation of ciphertext"` Filepath string `short:"f" long:"filepath" description:"Path of file to get encrypted string from" default:"./cipher.txt"` SingleLine bool `short:"s" long:"singleLine" description:"Disable use of newline chars in ciphertext"` }
ReencryptCommand type
func (*ReencryptCommand) Execute ¶
func (x *ReencryptCommand) Execute(args []string) error
Execute executes the ReencryptCommand