Skip to content

Commit 9d644b4

Browse files
committed
other serialization3
1 parent 04a11a7 commit 9d644b4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/integ/conftest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from typing import Any, Callable, ContextManager, Generator
1111

1212
import pytest
13+
from cryptography.hazmat.primitives import serialization
1314

1415
import snowflake.connector
1516
from snowflake.connector.compat import IS_WINDOWS
@@ -194,7 +195,12 @@ def get_db_parameters(connection_name: str = "default") -> dict[str, Any]:
194195

195196
def get_private_key(private_key_file: str) -> bytes:
196197
with open(private_key_file, "rb") as key_file:
197-
return key_file.read()
198+
private_key = serialization.load_pem_private_key(key_file.read(), password=None)
199+
return private_key.private_bytes(
200+
encoding=serialization.Encoding.DER,
201+
format=serialization.PrivateFormat.PKCS8,
202+
encryption_algorithm=serialization.NoEncryption(),
203+
)
198204

199205

200206
@pytest.fixture(scope="session", autouse=True)

0 commit comments

Comments
 (0)