Skip to content

Commit

Permalink
Merge pull request #72 from skit-ai/vcore_key
Browse files Browse the repository at this point in the history
Add log statement to fetch key
  • Loading branch information
vipul-sharma20 authored Jun 14, 2024
2 parents c138482 + 9f5300a commit 921d98c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions crypto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"crypto/aes"
"crypto/cipher"
"encoding/base64"
"fmt"
"os"

"github.com/hashicorp/vault/api"
Expand All @@ -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

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 921d98c

Please sign in to comment.