From 5b30c6efcad1fad526cdf36cada17b2343d6dd8c Mon Sep 17 00:00:00 2001 From: Michal Bobowski Date: Wed, 6 Nov 2024 17:07:13 +0100 Subject: [PATCH] SNOW-1728000 Switch to key with no password --- test/test_suit/test_utils.py | 31 ------------------------------- test/test_verify.py | 6 ++---- 2 files changed, 2 insertions(+), 35 deletions(-) diff --git a/test/test_suit/test_utils.py b/test/test_suit/test_utils.py index b44b2d970..1c0b99389 100644 --- a/test/test_suit/test_utils.py +++ b/test/test_suit/test_utils.py @@ -28,34 +28,3 @@ class NonRetryableError(Error): def __init__(self, msg=""): self.msg = msg - - -def parsePrivateKey(pk, pk_passphrase): - pkpass = None - if len(pk_passphrase) != 0: - pkpass = pk_passphrase.encode() - - # remove header, footer, and line breaks - pk = re.sub("-+[A-Za-z ]+-+", "", pk) - pk = re.sub("\\s", "", pk) - - pkBuilder = "" - pkBuilder += "-----BEGIN ENCRYPTED PRIVATE KEY-----" - for i, c in enumerate(pk): - if i % 64 == 0: - pkBuilder += "\n" - pkBuilder += c - pkBuilder += "\n-----END ENCRYPTED PRIVATE KEY-----" - - p_key = serialization.load_pem_private_key( - pkBuilder.encode(), - password=pkpass, - backend=default_backend() - ) - - pkb = p_key.private_bytes( - encoding=serialization.Encoding.DER, - format=serialization.PrivateFormat.PKCS8, - encryption_algorithm=serialization.NoEncryption()) - - return pkb diff --git a/test/test_verify.py b/test/test_verify.py index 63fe639ba..422a0df3b 100755 --- a/test/test_verify.py +++ b/test/test_verify.py @@ -19,7 +19,7 @@ import time import test_suit -from test_suit.test_utils import parsePrivateKey, RetryableError +from test_suit.test_utils import RetryableError from cloud_platform import CloudPlatform @@ -57,8 +57,7 @@ def __init__(self, kafkaAddress, schemaRegistryAddress, kafkaConnectAddress, cre testDatabase = credentialJson["database"] testSchema = credentialJson["schema"] testWarehouse = credentialJson["warehouse"] - pk = credentialJson["encrypted_private_key"] - pk_passphrase = credentialJson["private_key_passphrase"] + pk = credentialJson["private_key"] self.TEST_DATA_FOLDER = "./test_data/" self.httpHeader = {'Content-type': 'application/json', 'Accept': 'application/json'} @@ -103,7 +102,6 @@ def __init__(self, kafkaAddress, schemaRegistryAddress, kafkaConnectAddress, cre print(datetime.now().strftime("%H:%M:%S "), "Format error in 'host' field at profile.json, expecting account.snowflakecomputing.com:443") - pkb = parsePrivateKey(pk, pk_passphrase) self.snowflake_conn = snowflake.connector.connect( user=testUser, private_key=pkb,