From 9f5300ab456aea2b3af97f8f1dbb9cbf0542ca4f Mon Sep 17 00:00:00 2001 From: "joel.mathew" Date: Fri, 14 Jun 2024 11:59:32 +0530 Subject: [PATCH] Add log statement to fetch key --- crypto/main.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crypto/main.go b/crypto/main.go index e4dec4f..81f523d 100644 --- a/crypto/main.go +++ b/crypto/main.go @@ -6,6 +6,7 @@ import ( "crypto/aes" "crypto/cipher" "encoding/base64" + "fmt" "os" "github.com/hashicorp/vault/api" @@ -23,6 +24,7 @@ var vault_data_key_name string = os.Getenv("VAULT_DATA_KEY_NAME") var encrypted_data_key string = os.Getenv("ENCRYPTED_DATA_KEY") var use_static_data_key bool = env.Bool("USE_STATIC_DATA_KEY", false) var static_data_key string = env.String("STATIC_DATA_KEY", "") +var log_crypto_internal_info bool = env.Bool("LOG_CRYPTO_INTERNAL_INFO", false) // Other Global Variables @@ -155,6 +157,11 @@ func newCipherAESGCMObject(data_key_b64_str string, clientId string) (gcm cipher } else { data_key = getDataKey(data_key_b64_str, clientId) } + + if log_crypto_internal_info { + fmt.Printf("Data Key obtained - %s", data_key) + } + // Generate new aes cipher using our 32 byte key c, err := aes.NewCipher(data_key) if err != nil {