nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1diff --git a/src/controller/python/chip/crypto/p256keypair.py b/src/controller/python/chip/crypto/p256keypair.py
2index 30198eabee..926f55318e 100644
3--- a/src/controller/python/chip/crypto/p256keypair.py
4+++ b/src/controller/python/chip/crypto/p256keypair.py
5@@ -22,7 +22,6 @@ from ctypes import (CFUNCTYPE, POINTER, _Pointer, c_bool, c_char, c_size_t, c_ui
6 from typing import TYPE_CHECKING
7
8 from chip import native
9-from ecdsa import ECDH, NIST256p, SigningKey # type: ignore
10
11 # WORKAROUND: Create a subscriptable pointer type (with square brackets) to ensure compliance of type hinting with ctypes
12 if not TYPE_CHECKING:
13@@ -133,31 +132,3 @@ class P256Keypair:
14 format of section 2.3.3 of the SECG SEC 1 standard.
15 '''
16 raise NotImplementedError()
17-
18-
19-class TestP256Keypair(P256Keypair):
20- ''' The P256Keypair for testing purpose. It is not safe for any productions use
21- '''
22-
23- def __init__(self, private_key: SigningKey = None):
24- super().__init__()
25-
26- if private_key is None:
27- self._key = SigningKey.generate(NIST256p)
28- else:
29- self._key = private_key
30-
31- self._pubkey = self._key.verifying_key.to_string(encoding='uncompressed')
32-
33- @property
34- def public_key(self) -> bytes:
35- return self._pubkey
36-
37- def ECDSA_sign_msg(self, message: bytes) -> bytes:
38- return self._key.sign_deterministic(message, hashfunc=hashlib.sha256)
39-
40- def ECDH_derive_secret(self, remote_pubkey: bytes) -> bytes:
41- ecdh = ECDH(curve=NIST256p)
42- ecdh.load_private_key(self._key)
43- ecdh.load_received_public_key_bytes(remote_pubkey[1:])
44- return ecdh.ecdh1.generate_sharedsecret_bytes()