Skip to content

Commit

Permalink
Merge branch 'fix/ci_example_test_prov_v3.2' into 'release/v3.2'
Browse files Browse the repository at this point in the history
CI: Fix prov example test exception handle (v3.2)

See merge request espressif/esp-idf!8442
  • Loading branch information
projectgus committed Apr 24, 2020
2 parents acfee76 + fc067fd commit 43175f2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions tools/esp_prov/security/security1.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from .security import *

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.ciphers import Cipher, algorithms, modes

Expand Down Expand Up @@ -79,7 +79,13 @@ def security1_session(self, response_data):
def __generate_key(self):
# Generate private and public key pair for client
self.client_private_key = X25519PrivateKey.generate()
self.client_public_key = self.client_private_key.public_key().public_bytes()
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()

def _print_verbose(self, data):
if (self.verbose):
Expand Down

0 comments on commit 43175f2

Please sign in to comment.