mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
CI: Fix prov example test cryptography package version exception handling
This commit is contained in:
parent
44939a6b1e
commit
745e979283
@ -24,7 +24,7 @@ import proto
|
|||||||
from .security import Security
|
from .security import Security
|
||||||
|
|
||||||
from cryptography.hazmat.backends import default_backend
|
from cryptography.hazmat.backends import default_backend
|
||||||
from cryptography.hazmat.primitives import hashes
|
from cryptography.hazmat.primitives import hashes, serialization
|
||||||
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey, X25519PublicKey
|
from cryptography.hazmat.primitives.asymmetric.x25519 import X25519PrivateKey, X25519PublicKey
|
||||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||||
|
|
||||||
@ -82,6 +82,12 @@ class Security1(Security):
|
|||||||
def __generate_key(self):
|
def __generate_key(self):
|
||||||
# Generate private and public key pair for client
|
# Generate private and public key pair for client
|
||||||
self.client_private_key = X25519PrivateKey.generate()
|
self.client_private_key = X25519PrivateKey.generate()
|
||||||
|
try:
|
||||||
|
self.client_public_key = self.client_private_key.public_key().public_bytes(
|
||||||
|
encoding=serialization.Encoding.Raw,
|
||||||
|
format=serialization.PublicFormat.Raw)
|
||||||
|
except TypeError:
|
||||||
|
# backward compatible call for older cryptography library
|
||||||
self.client_public_key = self.client_private_key.public_key().public_bytes()
|
self.client_public_key = self.client_private_key.public_key().public_bytes()
|
||||||
|
|
||||||
def _print_verbose(self, data):
|
def _print_verbose(self, data):
|
||||||
|
Loading…
Reference in New Issue
Block a user