func (crypter *kmsCrypter) EncryptSecret(secretRecord *dao.SecretRecord, secret string) (*dao.SecretRecord, error) {
	// call kms to get datakey
	result, err := crypter.generateDataKey()
	if err != nil {
		return nil, err
	}

	// encrypt secret with that datakey
	encryptedBlob, err := encrypt(secret, result.Plaintext)
	if err != nil {
		return nil, err
	}

	// store the encrypted datakey and the encrypted data
	secretRecord.EncryptedData = base64Encode(encryptedBlob)
	secretRecord.EncryptedDataKey = base64Encode(result.CiphertextBlob)
	return secretRecord, nil
}
// EncryptSecret encrypts a secret record using a KMS data key
EncryptSecret encrypts a secret record using a KMS data key
// EncryptSecret encrypts a secret record using a KMS data key
func (crypter *kmsCrypter) EncryptSecret(secretRecord *dao.SecretRecord, secret string) (*dao.SecretRecord, error) {
	result, err := crypter.generateDataKey()
	if err != nil {
		return nil, err
	}
	encryptedBlob, err := encrypt(secret, result.Plaintext)
	if err != nil {
		return nil, err
	}
	secretRecord.EncryptedData = base64Encode(encryptedBlob)
	secretRecord.EncryptedDataKey = base64Encode(result.CiphertextBlob)
	return secretRecord, nil
}
func ( crypter * kmsCrypter ) EncryptSecret ( secretRecord * dao . SecretRecord , secret string ) ( * dao . SecretRecord , error ) { result , err := crypter . generateDataKey ( ) if err != nil { return nil , err } encryptedBlob , err := encrypt ( secret , result . Plaintext ) if err != nil { return nil , err } secretRecord . EncryptedData = base64Encode ( encryptedBlob ) secretRecord . EncryptedDataKey = base64Encode ( result . CiphertextBlob ) return secretRecord , nil }
EncryptSecret encrypts a secret record using a KMS data key
EncryptSecret encrypts a secret record using a KMS data key
// call kms to get datakey // encrypt secret with that datakey // store the encrypted datakey and the encrypted data