Documentation ¶
Index ¶
Constants ¶
const ( // A256GCM identifies the encryption algorithm A256GCM = "A256GCM" // B5JWKJSON identifies content type B5JWKJSON = "b5+jwk+json" )
Variables ¶
This section is empty.
Functions ¶
func DecryptEnvelope ¶
DecryptEnvelope will access the key service and decrypt the envelope.
Types ¶
type AwsKeyService ¶
type AwsKeyService struct {
// contains filtered or unexported fields
}
AwsKeyService represents connection to Amazon Web Services KMS
func NewAwsKeyService ¶
func NewAwsKeyService(region string, masterKeyID string) *AwsKeyService
NewAwsKeyService creates a new AwsKeyService in given AWS region and with the given masterKey identifier.
func (*AwsKeyService) DecryptKey ¶
func (s *AwsKeyService) DecryptKey(key *EncryptionKey) error
DecryptKey decrypts an existing ServerKey.
func (*AwsKeyService) GenerateKey ¶
func (s *AwsKeyService) GenerateKey(kid string) (*EncryptionKey, error)
GenerateKey generates a brand new ServerKey.
type DevKeyService ¶
type DevKeyService struct {
// contains filtered or unexported fields
}
DevKeyService contains DevKeyService information
func NewDevKeyService ¶
func NewDevKeyService() *DevKeyService
NewDevKeyService returns an empty DevKeyService object
func (*DevKeyService) DecryptKey ¶
func (s *DevKeyService) DecryptKey(key *EncryptionKey) error
DecryptKey decrypts the dev key
func (*DevKeyService) GenerateKey ¶
func (s *DevKeyService) GenerateKey(kid string) (*EncryptionKey, error)
GenerateKey generates a new server key
type EncryptionKey ¶
type EncryptionKey struct { KID string `json:"kid"` Enc string `json:"enc"` EncKey string `json:"encKey"` RawKey []byte `json:"-"` }
EncryptionKey contians server key information
type Envelope ¶
type Envelope struct { Env string `json:"env"` Region string `json:"region,omitempty"` MasterKeyID string `json:"master,omitempty"` Key EncryptionKey `json:"key"` Data string `json:"data"` }
Envelope defines JSON structure that wraps the encrypted content
func EncryptEnvelope ¶
EncryptEnvelope will generate a new key and encrypt the message. It returns the Envelope that contains everything that is needed to decrypt the message (if the access to the KeyService is granted).
type KeyService ¶
type KeyService interface { GenerateKey(kid string) (*EncryptionKey, error) DecryptKey(key *EncryptionKey) error }
KeyService defines key methods