Skip to content

Commit

Permalink
Neues Todo füg die möglichkeit ein den algorithmus zu wechseln (rsa o…
Browse files Browse the repository at this point in the history
…der ec)
  • Loading branch information
SirGankalot committed Jun 18, 2024
1 parent e892856 commit 911d3f2
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions exploit/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import ec


import base64

# Generate ECC key pair
private_key = ec.generate_private_key(ec.SECP256R1())
public_key = private_key.public_key()
print("private_key",private_key)
print("public_key",public_key)

# ----- SETUP -----

Expand All @@ -34,10 +44,11 @@ def format_rsa_public_key(key_str):
return formatted_key


public_key = "-----BEGIN PUBLIC KEY-----\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAO0PAC8qfkJFt+Uxm+yOH7x+3jvBZCg6\nQMzN83dV7c4E1UFsGj5QY4+goahPpxqq8nCb6+FfHfoYhb6iR1G6ngcCAwEAAQ==\n-----END PUBLIC KEY-----\n"
PUBKEY = RSA.import_key(public_key)
PUBKEY = PUBKEY.public_key().export_key(format='PEM')
print(PUBKEY)
#public_key = "-----BEGIN PUBLIC KEY-----\nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAO0PAC8qfkJFt+Uxm+yOH7x+3jvBZCg6\nQMzN83dV7c4E1UFsGj5QY4+goahPpxqq8nCb6+FfHfoYhb6iR1G6ngcCAwEAAQ==\n-----END PUBLIC KEY-----\n"
# PUBKEY = RSA.import_key(public_key)
# PUBKEY = PUBKEY.public_key().export_key(format='PEM')
PUBKEY = public_key.public_bytes(encoding=serialization.Encoding.PEM, format=serialization.PublicFormat.SubjectPublicKeyInfo)
print("Das hier ist der Publickey",PUBKEY)


b64 = lambda x:base64.urlsafe_b64encode(x).replace(b'=',b'')
Expand Down

0 comments on commit 911d3f2

Please sign in to comment.