From 44a1316bc7860d50b27d006d040c5dfff0d62b45 Mon Sep 17 00:00:00 2001 From: Ryan Johnson Date: Sun, 28 Apr 2024 20:22:08 -0400 Subject: [PATCH] chore: update to sha256 for session file In general, vSphere is maving from SHA1 to SHA256-based TLS certificate thumbprints. This change allows the use of a SHA256 thumbprint when connecting to vCenter Server. Support for SHA256 was added to `vmware/govmomi` v0.36.1. Signed-off-by: Ryan Johnson --- vsphere/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vsphere/config.go b/vsphere/config.go index f3e436e70..3ca401eda 100644 --- a/vsphere/config.go +++ b/vsphere/config.go @@ -5,7 +5,7 @@ package vsphere import ( "context" - "crypto/sha1" + "crypto/sha256" "encoding/json" "fmt" "io" @@ -325,7 +325,7 @@ func (c *Config) sessionFile() (string, error) { // Key session file off of full URI and insecure setting. // Hash key to get a predictable, canonical format. key := fmt.Sprintf("%s#insecure=%t", u.String(), c.InsecureFlag) - name := fmt.Sprintf("%040x", sha1.Sum([]byte(key))) + name := fmt.Sprintf("%040x", sha256.Sum256([]byte(key))) return name, nil }