|
11 | 11 | from typing import Dict
|
12 | 12 | import unittest
|
13 | 13 | from cryptography import x509
|
| 14 | +from cryptography.hazmat.backends import default_backend |
14 | 15 | from cryptography.hazmat.primitives import hashes, serialization
|
15 | 16 | from cryptography.hazmat.primitives.asymmetric.dsa import DSAPublicKey
|
16 | 17 | from devtools_testutils import AzureTestCase, ResourceGroupPreparer, PowerShellPreparer
|
@@ -116,21 +117,21 @@ def callback(token, signer):
|
116 | 117 | # Helper functions to create keys and certificates wrapping those keys.
|
117 | 118 | @staticmethod
|
118 | 119 | def _create_ecds_key(): #type() -> EllipticCurvePrivateKey
|
119 |
| - return ec.generate_private_key(ec.SECP256R1()).private_bytes( |
| 120 | + return ec.generate_private_key(ec.SECP256R1(), backend=default_backend()).private_bytes( |
120 | 121 | serialization.Encoding.DER,
|
121 | 122 | serialization.PrivateFormat.PKCS8,
|
122 | 123 | serialization.NoEncryption())
|
123 | 124 |
|
124 | 125 | @staticmethod
|
125 | 126 | def _create_rsa_key(): #type() -> EllipticCurvePrivateKey
|
126 |
| - return rsa.generate_private_key(65537, 2048).private_bytes( |
| 127 | + return rsa.generate_private_key(65537, 2048, backend=default_backend()).private_bytes( |
127 | 128 | serialization.Encoding.DER,
|
128 | 129 | serialization.PrivateFormat.PKCS8,
|
129 | 130 | serialization.NoEncryption())
|
130 | 131 |
|
131 | 132 | @staticmethod
|
132 | 133 | def _create_x509_certificate(key_der, subject_name): #type(Union[EllipticCurvePrivateKey,RSAPrivateKey], str) -> Certificate
|
133 |
| - signing_key = serialization.load_der_private_key(key_der, password=None) |
| 134 | + signing_key = serialization.load_der_private_key(key_der, password=None, backend=default_backend()) |
134 | 135 | builder = CertificateBuilder()
|
135 | 136 | builder = builder.subject_name(x509.Name([
|
136 | 137 | x509.NameAttribute(NameOID.COMMON_NAME, subject_name),
|
|
0 commit comments