aboutsummaryrefslogtreecommitdiff
path: root/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info
diff options
context:
space:
mode:
Diffstat (limited to '.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info')
-rw-r--r--.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/INSTALLER1
-rw-r--r--.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/METADATA246
-rw-r--r--.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/RECORD38
-rw-r--r--.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/WHEEL5
-rw-r--r--.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/licenses/LICENSE21
-rw-r--r--.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/top_level.txt1
6 files changed, 312 insertions, 0 deletions
diff --git a/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/INSTALLER b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/INSTALLER
new file mode 100644
index 00000000..a1b589e3
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/METADATA b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/METADATA
new file mode 100644
index 00000000..8b88273a
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/METADATA
@@ -0,0 +1,246 @@
+Metadata-Version: 2.4
+Name: starkbank-ecdsa
+Version: 2.2.0
+Summary: A lightweight and fast pure python ECDSA library
+Home-page: https://github.com/starkbank/ecdsa-python.git
+Author: Stark Bank
+Author-email: developers@starkbank.com
+License: MIT License
+Keywords: ecdsa,elliptic curve,elliptic,curve,stark bank,starkbank,cryptograph,secp256k1,prime256v1
+Description-Content-Type: text/markdown
+License-File: LICENSE
+Dynamic: author
+Dynamic: author-email
+Dynamic: description
+Dynamic: description-content-type
+Dynamic: home-page
+Dynamic: keywords
+Dynamic: license
+Dynamic: license-file
+Dynamic: summary
+
+## A lightweight and fast pure Python ECDSA
+
+### Overview
+
+We tried other Python libraries such as [python-ecdsa], [fast-ecdsa] and other less famous ones, but we didn't find anything that suited our needs. The first one was pure Python, but it was too slow. The second one mixed Python and C and it was really fast, but we were unable to use it in our current infrastructure, which required pure Python code.
+
+For this reason, we decided to create something simple, compatible with OpenSSL and fast using elegant math such as Jacobian Coordinates to speed up the ECDSA. Starkbank-ECDSA is fully compatible with Python2 and Python3.
+
+### Installation
+
+To install StarkBank`s ECDSA-Python, run:
+
+```sh
+pip install starkbank-ecdsa
+```
+
+### Curves
+
+We currently support `secp256k1`, but you can add more curves to the project. You just need to use the curve.add() function.
+
+### Speed
+
+We ran a test on a MAC Pro i7 2017. The libraries were run 100 times and the averages displayed bellow were obtained:
+
+| Library | sign | verify |
+| ------------------ |:-------------:| -------:|
+| [python-ecdsa] | 121.3ms | 65.1ms |
+| [fast-ecdsa] | 0.1ms | 0.2ms |
+| starkbank-ecdsa | 4.1ms | 7.8ms |
+
+Our pure Python code cannot compete with C based libraries, but it's `6x faster` to verify and `23x faster` to sign than other pure Python libraries.
+
+### Sample Code
+
+How to sign a json message for [Stark Bank]:
+
+```python
+from json import dumps
+from ellipticcurve.ecdsa import Ecdsa
+from ellipticcurve.privateKey import PrivateKey
+
+
+# Generate privateKey from PEM string
+privateKey = PrivateKey.fromPem("""
+ -----BEGIN EC PARAMETERS-----
+ BgUrgQQACg==
+ -----END EC PARAMETERS-----
+ -----BEGIN EC PRIVATE KEY-----
+ MHQCAQEEIODvZuS34wFbt0X53+P5EnSj6tMjfVK01dD1dgDH02RzoAcGBSuBBAAK
+ oUQDQgAE/nvHu/SQQaos9TUljQsUuKI15Zr5SabPrbwtbfT/408rkVVzq8vAisbB
+ RmpeRREXj5aog/Mq8RrdYy75W9q/Ig==
+ -----END EC PRIVATE KEY-----
+""")
+
+# Create message from json
+message = dumps({
+ "transfers": [
+ {
+ "amount": 100000000,
+ "taxId": "594.739.480-42",
+ "name": "Daenerys Targaryen Stormborn",
+ "bankCode": "341",
+ "branchCode": "2201",
+ "accountNumber": "76543-8",
+ "tags": ["daenerys", "targaryen", "transfer-1-external-id"]
+ }
+ ]
+})
+
+signature = Ecdsa.sign(message, privateKey)
+
+# Generate Signature in base64. This result can be sent to Stark Bank in the request header as the Digital-Signature parameter.
+print(signature.toBase64())
+
+# To double check if the message matches the signature, do this:
+publicKey = privateKey.publicKey()
+
+print(Ecdsa.verify(message, signature, publicKey))
+
+```
+
+Simple use:
+
+```python
+from ellipticcurve.ecdsa import Ecdsa
+from ellipticcurve.privateKey import PrivateKey
+
+
+# Generate new Keys
+privateKey = PrivateKey()
+publicKey = privateKey.publicKey()
+
+message = "My test message"
+
+# Generate Signature
+signature = Ecdsa.sign(message, privateKey)
+
+# To verify if the signature is valid
+print(Ecdsa.verify(message, signature, publicKey))
+
+```
+
+How to add more curves:
+
+```python
+from ellipticcurve import curve, PrivateKey, PublicKey
+
+newCurve = curve.CurveFp(
+ name="frp256v1",
+ A=0xf1fd178c0b3ad58f10126de8ce42435b3961adbcabc8ca6de8fcf353d86e9c00,
+ B=0xee353fca5428a9300d4aba754a44c00fdfec0c9ae4b1a1803075ed967b7bb73f,
+ P=0xf1fd178c0b3ad58f10126de8ce42435b3961adbcabc8ca6de8fcf353d86e9c03,
+ N=0xf1fd178c0b3ad58f10126de8ce42435b53dc67e140d2bf941ffdd459c6d655e1,
+ Gx=0xb6b3d4c356c139eb31183d4749d423958c27d2dcaf98b70164c97a2dd98f5cff,
+ Gy=0x6142e0f7c8b204911f9271f0f3ecef8c2701c307e8e4c9e183115a1554062cfb,
+ oid=[1, 2, 250, 1, 223, 101, 256, 1]
+)
+
+curve.add(newCurve)
+
+publicKeyPem = """-----BEGIN PUBLIC KEY-----
+MFswFQYHKoZIzj0CAQYKKoF6AYFfZYIAAQNCAATeEFFYiQL+HmDYTf+QDmvQmWGD
+dRJPqLj11do8okvkSxq2lwB6Ct4aITMlCyg3f1msafc/ROSN/Vgj69bDhZK6
+-----END PUBLIC KEY-----"""
+
+publicKey = PublicKey.fromPem(publicKeyPem)
+
+print(publicKey.toPem())
+```
+
+How to generate compressed public key:
+
+```python
+from ellipticcurve import PrivateKey, PublicKey
+
+privateKey = PrivateKey()
+publicKey = privateKey.publicKey()
+compressedPublicKey = publicKey.toCompressed()
+
+print(compressedPublicKey)
+```
+
+How to recover a compressed public key:
+
+```python
+from ellipticcurve import PrivateKey, PublicKey
+
+compressedPublicKey = "0252972572d465d016d4c501887b8df303eee3ed602c056b1eb09260dfa0da0ab2"
+publicKey = PublicKey.fromCompressed(compressedPublicKey)
+
+print(publicKey.toPem())
+```
+
+### OpenSSL
+
+This library is compatible with OpenSSL, so you can use it to generate keys:
+
+```
+openssl ecparam -name secp256k1 -genkey -out privateKey.pem
+openssl ec -in privateKey.pem -pubout -out publicKey.pem
+```
+
+Create a message.txt file and sign it:
+
+```
+openssl dgst -sha256 -sign privateKey.pem -out signatureDer.txt message.txt
+```
+
+To verify, do this:
+
+```python
+from ellipticcurve.ecdsa import Ecdsa
+from ellipticcurve.signature import Signature
+from ellipticcurve.publicKey import PublicKey
+from ellipticcurve.utils.file import File
+
+
+publicKeyPem = File.read("publicKey.pem")
+signatureDer = File.read("signatureDer.txt", "rb")
+message = File.read("message.txt")
+
+publicKey = PublicKey.fromPem(publicKeyPem)
+signature = Signature.fromDer(signatureDer)
+
+print(Ecdsa.verify(message, signature, publicKey))
+
+```
+
+You can also verify it on terminal:
+
+```
+openssl dgst -sha256 -verify publicKey.pem -signature signatureDer.txt message.txt
+```
+
+NOTE: If you want to create a Digital Signature to use with [Stark Bank], you need to convert the binary signature to base64.
+
+```
+openssl base64 -in signatureDer.txt -out signatureBase64.txt
+```
+
+You can do the same with this library:
+
+```python
+from ellipticcurve.signature import Signature
+from ellipticcurve.utils.file import File
+
+
+signatureDer = File.read("signatureDer.txt", "rb")
+
+signature = Signature.fromDer(signatureDer)
+
+print(signature.toBase64())
+```
+
+### Run unit tests
+
+```
+python3 -m unittest discover
+python2 -m unittest discover
+```
+
+
+[python-ecdsa]: https://github.com/warner/python-ecdsa
+[fast-ecdsa]: https://github.com/AntonKueltz/fastecdsa
+[Stark Bank]: https://starkbank.com
diff --git a/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/RECORD b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/RECORD
new file mode 100644
index 00000000..4d5a1a99
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/RECORD
@@ -0,0 +1,38 @@
+ellipticcurve/__init__.py,sha256=uhzBWTIHNxb8SfRGE9MQ_fxdc_nVcQA2jZ1kIvGoeX0,190
+ellipticcurve/__pycache__/__init__.cpython-312.pyc,,
+ellipticcurve/__pycache__/curve.cpython-312.pyc,,
+ellipticcurve/__pycache__/ecdsa.cpython-312.pyc,,
+ellipticcurve/__pycache__/math.cpython-312.pyc,,
+ellipticcurve/__pycache__/point.cpython-312.pyc,,
+ellipticcurve/__pycache__/privateKey.cpython-312.pyc,,
+ellipticcurve/__pycache__/publicKey.cpython-312.pyc,,
+ellipticcurve/__pycache__/signature.cpython-312.pyc,,
+ellipticcurve/curve.py,sha256=aguiVm-AX8Mu31daW5KxV4b1UdplYTMAq17SBOBWMRw,2697
+ellipticcurve/ecdsa.py,sha256=nzj5i0IyzRvCLAfzyuoD96OqA7Zubx2U_WvRPKzFx6A,1768
+ellipticcurve/math.py,sha256=4GgaPC1o6UOkd5TVsRUxE7Uu3NIxJRm4elUU-MQBtkk,5497
+ellipticcurve/point.py,sha256=kOCpgF9dpZbSrkBkGCP8bmydDfnU4ndF9YOAMcC_e2g,262
+ellipticcurve/privateKey.py,sha256=_UlcPXwIijE5MzN0Wm7HVMTF2Puu2NAuCGlSJ36fUwg,2728
+ellipticcurve/publicKey.py,sha256=xjmaFF1ntbiayb6Wcy3gJsqTN9Hl7SJ-ptqVyW4euhc,3815
+ellipticcurve/signature.py,sha256=CWWsLnvQGEqlNMq5grArcRXAgZSN6F16pp9ogBfuxzA,1648
+ellipticcurve/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+ellipticcurve/utils/__pycache__/__init__.cpython-312.pyc,,
+ellipticcurve/utils/__pycache__/binary.cpython-312.pyc,,
+ellipticcurve/utils/__pycache__/compatibility.cpython-312.pyc,,
+ellipticcurve/utils/__pycache__/der.cpython-312.pyc,,
+ellipticcurve/utils/__pycache__/file.cpython-312.pyc,,
+ellipticcurve/utils/__pycache__/integer.cpython-312.pyc,,
+ellipticcurve/utils/__pycache__/oid.cpython-312.pyc,,
+ellipticcurve/utils/__pycache__/pem.cpython-312.pyc,,
+ellipticcurve/utils/binary.py,sha256=IDBlkiGiZOJIc_c_H2mB4t254JQDyU6v3wp9oVg6dW0,860
+ellipticcurve/utils/compatibility.py,sha256=vR-NwCD8gxp8G0-2-HeXR-1OvJGnv35OUl8X2Rh8m5w,1027
+ellipticcurve/utils/der.py,sha256=OQINZ2GYmZKyshIbhCgCLUs6TlRKNKicLnDp--Hr-2M,4747
+ellipticcurve/utils/file.py,sha256=Z7tQmQ3TE1rXWgRIwKBo28u6bj_78Z-RwpteT6LCn_4,163
+ellipticcurve/utils/integer.py,sha256=6kGDovRPSQcL8BQy9K1rlYMEuP-AmEYhhvdxyb56Jak,355
+ellipticcurve/utils/oid.py,sha256=B1QHhRIcrqWBVeKESPV9NFP3V6N7SsAtN6aEYV6ScfY,1002
+ellipticcurve/utils/pem.py,sha256=YKucQ1fJRQgiafTALAkrGkwZKFyUorkIub_9JWAEXxQ,380
+starkbank_ecdsa-2.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+starkbank_ecdsa-2.2.0.dist-info/METADATA,sha256=8gLEDzWVgqGwARLE2e-NRIDqQ6gZ-aQOLRDHG7nZBNQ,6826
+starkbank_ecdsa-2.2.0.dist-info/RECORD,,
+starkbank_ecdsa-2.2.0.dist-info/WHEEL,sha256=L0N565qmK-3nM2eBoMNFszYJ_MTx03_tQ0CQu1bHLYo,91
+starkbank_ecdsa-2.2.0.dist-info/licenses/LICENSE,sha256=3sDLSQbqMOaxoJPNCMjEep3ufGRbBhO3rG2Q5MuZrmo,1072
+starkbank_ecdsa-2.2.0.dist-info/top_level.txt,sha256=0SiYX_JsMQxVpFKRMTs_Ep1DyfDIcnMonFFLgn2rsFQ,14
diff --git a/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/WHEEL b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/WHEEL
new file mode 100644
index 00000000..c8c82f37
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: setuptools (78.0.1)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/licenses/LICENSE b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/licenses/LICENSE
new file mode 100644
index 00000000..0e48bcd0
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/licenses/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Stark Bank S.A.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/top_level.txt b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/top_level.txt
new file mode 100644
index 00000000..e9e4ff61
--- /dev/null
+++ b/.venv/lib/python3.12/site-packages/starkbank_ecdsa-2.2.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+ellipticcurve