-
-
Save yasudacloud/c00c03467eaa898b4c1c02abc3ddcc46 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from cryptography.hazmat.backends import default_backend | |
| from cryptography.hazmat.primitives.asymmetric import ec | |
| private_key = ec.generate_private_key(ec.SECP256R1(), default_backend()) | |
| private_bytes = private_key.private_numbers().private_value.to_bytes(32, byteorder='big') | |
| public_numbers = private_key.public_key().public_numbers() | |
| x_bytes = public_numbers.x.to_bytes(32, byteorder='big') | |
| y_bytes = public_numbers.y.to_bytes(32, byteorder='big') | |
| public_bytes = x_bytes + y_bytes | |
| # この2つを使う | |
| print(private_bytes) | |
| print(public_bytes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment