Documentation
¶
Index ¶
- func NewSimpleTestKMS() config.KeyManagementService
- func NewTestCrypto(t interface{}) (*encx.Crypto, error)
- type SimpleTestKMS
- func (s *SimpleTestKMS) CreateKey(ctx context.Context, description string) (string, error)
- func (s *SimpleTestKMS) DecryptDEK(ctx context.Context, keyID string, ciphertext []byte) ([]byte, error)
- func (s *SimpleTestKMS) EncryptDEK(ctx context.Context, keyID string, plaintext []byte) ([]byte, error)
- func (s *SimpleTestKMS) GetKeyID(ctx context.Context, alias string) (string, error)
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSimpleTestKMS ¶
func NewSimpleTestKMS() config.KeyManagementService
NewSimpleTestKMS creates a new simple test KMS with a default key
func NewTestCrypto ¶
NewTestCrypto creates a simple Crypto instance for testing and examples If t is nil, creates a basic test crypto for examples/demos
Types ¶
type SimpleTestKMS ¶
type SimpleTestKMS struct {
// contains filtered or unexported fields
}
SimpleTestKMS implements a basic in-memory KMS for testing and examples
func (*SimpleTestKMS) DecryptDEK ¶
func (s *SimpleTestKMS) DecryptDEK(ctx context.Context, keyID string, ciphertext []byte) ([]byte, error)
DecryptDEK decrypts the DEK using AES-GCM
func (*SimpleTestKMS) EncryptDEK ¶
func (s *SimpleTestKMS) EncryptDEK(ctx context.Context, keyID string, plaintext []byte) ([]byte, error)
EncryptDEK encrypts the DEK using AES-GCM
type User ¶
type User struct {
ID int `json:"id"`
Email string `json:"email" encx:"encrypt,hash_basic"`
Phone string `json:"phone" encx:"encrypt"`
SSN string `json:"ssn" encx:"hash_secure"`
// Added a comment to change the file hash
Name string `json:"name"`
// Companion fields for encryption/hashing
EmailEncrypted []byte `json:"email_encrypted" db:"email_encrypted"`
EmailHash string `json:"email_hash" db:"email_hash"`
PhoneEncrypted []byte `json:"phone_encrypted" db:"phone_encrypted"`
SSNHashSecure string `json:"ssn_hash_secure" db:"ssn_hash_secure"`
}
User represents a user with encrypted fields
Click to show internal directories.
Click to hide internal directories.