Documentation ¶
Index ¶
- Constants
- Variables
- func ComputeHmac256(message, secret []byte) []byte
- func Decode(data map[string]*dynamodb.AttributeValue, rawVal interface{}) error
- func Decrypt(key, ciphertext []byte) ([]byte, error)
- func Encrypt(key, plaintext []byte) ([]byte, error)
- func GetHighestVersion(svc dynamoDB, tableName *string, name string) (string, error)
- type Client
- func (c *Client) DecryptDataKey(ciphertext []byte, ctx *EncryptionContextValue) (*DataKey, error)
- func (c *Client) DeleteSecret(tableName string, name string) error
- func (c *Client) GenerateRandomSecret(length int, useSymbols bool, charsets []interface{}, ...) (string, error)
- func (c *Client) GetHighestVersionSecret(table string, name string, encContext *EncryptionContextValue) (*DecryptedCredential, error)
- func (c *Client) GetSecret(name string, table string, paddedVersion string, ctx *EncryptionContextValue) (*DecryptedCredential, error)
- func (c *Client) PaddedInt(i int) string
- func (c *Client) PutSecret(tableName string, name string, value string, paddedVersion string, ...) error
- func (c *Client) ResolveVersion(tableName string, name string, version int) (string, error)
- type Credential
- type DataKey
- type DecryptedCredential
- type EncryptionContextValue
Constants ¶
const (
DefaultKmsKey = "alias/credstash"
)
const MaxPaddingLength = 19 // Number of digits in MaxInt64
Variables ¶
var ( ErrSecretNotFound = errors.New("Secret Not Found") // ErrHmacValidationFailed returned when the hmac signature validation fails ErrHmacValidationFailed = errors.New("Secret HMAC validation failed") )
Functions ¶
func ComputeHmac256 ¶ added in v0.7.0
ComputeHmac256 compute a hmac256 signature of the supplied message and return the value hex encoded
func Decode ¶ added in v0.7.0
func Decode(data map[string]*dynamodb.AttributeValue, rawVal interface{}) error
Decode decode the supplied struct from the dynamodb result map
func Decrypt ¶ added in v0.7.0
Decrypt AES encryption method which matches the pycrypto package using CTR and AES256. Note this routine seeds the counter/iv with a value of 1 then throws it away?!
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) DecryptDataKey ¶ added in v0.7.0
func (c *Client) DecryptDataKey(ciphertext []byte, ctx *EncryptionContextValue) (*DataKey, error)
DecryptDataKey ask kms to decrypt the supplied data key
func (*Client) DeleteSecret ¶ added in v0.7.0
func (*Client) GenerateRandomSecret ¶ added in v0.7.0
func (*Client) GetHighestVersionSecret ¶ added in v0.7.0
func (c *Client) GetHighestVersionSecret(table string, name string, encContext *EncryptionContextValue) (*DecryptedCredential, error)
GetHighestVersionSecret retrieves latest secret from dynamodb using the name
func (*Client) GetSecret ¶
func (c *Client) GetSecret(name string, table string, paddedVersion string, ctx *EncryptionContextValue) (*DecryptedCredential, error)
func (*Client) PaddedInt ¶ added in v0.7.0
PaddedInt returns an integer left-padded with zeroes to the max-int length
func (*Client) ResolveVersion ¶ added in v0.7.0
ResolveVersion converts an integer version to a string, or if a version isn't provided (0), returns "1" if the secret doesn't exist or the latest version plus one (auto-increment) if it does.
type Credential ¶ added in v0.7.0
type Credential struct { Name string `dynamodbav:"name"` Version string `dynamodbav:"version"` Key string `dynamodbav:"key"` Contents string `dynamodbav:"contents"` Hmac []byte `dynamodbav:"hmac"` CreatedAt int64 `dynamodbav:"created_at"` }
Credential managed credential information
type DecryptedCredential ¶ added in v0.7.0
type DecryptedCredential struct { *Credential Secret string }
type EncryptionContextValue ¶ added in v0.7.0
EncryptionContextValue key value with helper methods for flag parser
func NewEncryptionContextValue ¶ added in v0.7.0
func NewEncryptionContextValue() *EncryptionContextValue
NewEncryptionContextValue create a new encryption context
func (*EncryptionContextValue) IsCumulative ¶ added in v0.7.0
func (h *EncryptionContextValue) IsCumulative() bool
IsCumulative flag this value as cumulative
func (*EncryptionContextValue) Set ¶ added in v0.7.0
func (h *EncryptionContextValue) Set(value string) error
Set converts a flag value into an encryption context key value
func (*EncryptionContextValue) String ¶ added in v0.7.0
func (h *EncryptionContextValue) String() string