kms

package
v0.0.0-...-2731d20 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2017 License: LGPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

gokms - Go packages to interact with Amazon KMS (Key Management Service)

Written by Kiko Hsieh <kiko_hsieh@trend.com.tw>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AliasInfo

type AliasInfo struct {
	AliasArn    string
	AliasName   string
	TargetKeyId string
}

type DecryptInfo

type DecryptInfo struct {
	CiphertextBlob []byte
	ProduceKeyOpt
}

func (*DecryptInfo) ActionName

func (d *DecryptInfo) ActionName() string

type DecryptResp

type DecryptResp struct {
	KeyId     string
	Plaintext []byte
}

type DescribeKeyInfo

type DescribeKeyInfo struct {
	//4 forms for KeyId - http://docs.aws.amazon.com/kms/latest/APIReference/API_DescribeKey.html
	//1. Key ARN
	//2. Alias ARN
	//3. Globally Unique Key
	//4. Alias Name
	KeyId string
}

The following structs are the parameters when requesting to AWS KMS http://docs.aws.amazon.com/kms/latest/APIReference/API_Operations.html

func (*DescribeKeyInfo) ActionName

func (d *DescribeKeyInfo) ActionName() string

type DescribeKeyResp

type DescribeKeyResp struct {
	KeyMetadata struct {
		AWSAccountId string
		Arn          string
		CreationDate float64
		Description  string
		Enabled      bool
		KeyId        string
		KeyUsage     string
	}
}

The rersponse body from KMS, based on which action you take http://docs.aws.amazon.com/kms/latest/APIReference/API_Operations.html

type DisableKeyInfo

type DisableKeyInfo struct {
	//2 forms for KeyId - http://docs.aws.amazon.com/kms/latest/APIReference/API_DisableKey.html
	//1. Key ARN
	//2. Globally Unique KeyId
	KeyId string
}

func (*DisableKeyInfo) ActionName

func (d *DisableKeyInfo) ActionName() string

type EnableKeyInfo

type EnableKeyInfo struct {
	//2 forms for KeyId - http://docs.aws.amazon.com/kms/latest/APIReference/API_EnableKey.html
	//1. Key ARN
	//2. Globally Unique Key
	KeyId string
}

func (*EnableKeyInfo) ActionName

func (e *EnableKeyInfo) ActionName() string

type EncryptInfo

type EncryptInfo struct {
	//4 forms for KeyId - http://docs.aws.amazon.com/kms/latest/APIReference/API_Encrypt.html
	//1. Key ARN
	//2. Alias ARN
	//3. Globally Unique Key
	//4. Alias Name
	KeyId string
	ProduceKeyOpt
	Plaintext []byte
}

func (*EncryptInfo) ActionName

func (e *EncryptInfo) ActionName() string

type EncryptResp

type EncryptResp struct {
	CiphertextBlob []byte
	KeyId          string
}

type KMS

type KMS struct {
	aws.Auth
	aws.Region
}

func New

func New(auth aws.Auth, region aws.Region) *KMS

func (*KMS) Decrypt

func (k *KMS) Decrypt(info DecryptInfo) (DecryptResp, error)

func (*KMS) DescribeKey

func (k *KMS) DescribeKey(info DescribeKeyInfo) (DescribeKeyResp, error)

func (*KMS) DisableKey

func (k *KMS) DisableKey(info DisableKeyInfo) error

func (*KMS) EnableKey

func (k *KMS) EnableKey(info EnableKeyInfo) error

func (*KMS) Encrypt

func (k *KMS) Encrypt(info EncryptInfo) (EncryptResp, error)

func (*KMS) ListAliases

func (k *KMS) ListAliases(info ListAliasesInfo) (ListAliasesResp, error)

type KMSAction

type KMSAction interface {
	ActionName() string
}

type KMSError

type KMSError struct {
	StatusCode int    `json:",omitempty"`
	Type       string `json:"__type"`
	Message    string `json:"message"`
}

func (*KMSError) Error

func (k *KMSError) Error() string

type ListAliasesInfo

type ListAliasesInfo struct {
	//These parameters are optional. See http://docs.aws.amazon.com/kms/latest/APIReference/API_ListAliases.html
	Limit  int    `json:",omitempty"`
	Marker string `json:",omitempty"`
}

func (*ListAliasesInfo) ActionName

func (l *ListAliasesInfo) ActionName() string

type ListAliasesResp

type ListAliasesResp struct {
	Aliases    []AliasInfo
	NextMarker string
	Truncated  bool
}

type ProduceKeyOpt

type ProduceKeyOpt struct {
	EncryptionContext map[string]string `json:",omitempty"`
	GrantTokens       []string          `json:",omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL