Skip to content

Commit

Permalink
new update
Browse files Browse the repository at this point in the history
  • Loading branch information
sudoerr authored Dec 29, 2023
1 parent 77ea633 commit d5ad219
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions PyEasyCrypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,44 +190,4 @@ def decrpyt(self, data:bytes):
dec = unpadder.update(dec) + unpadder.finalize()
return dec





if __name__ == "__main__":
# c = ECDSA()
# # c.generate_new_keypair(b"mahdi")
# c.load_keys(b"mahdi")
# signature = c.sign(b"Hello World")
# with open("./data/keys/public.pem", "rb") as f:
# p_key_pem = f.read()
# print(c.verify(p_key_pem, signature, b"Hello World"))

# ========================================================

e = ECDH()
e.generate_keypair()
e2 = ECDH()
e2.generate_keypair()
e.generate_shared_key_and_derive(e2.get_public_key_pem())
e2.generate_shared_key_and_derive(e.get_public_key_pem())
print(e.get_derived_key() == e2.get_derived_key())

# ========================================================

message = b"hello world hois"
iv = os.urandom(16)
a = AES256CBC(e.get_derived_key(), iv)
enc = a.encrypt(message)
print("Encrypted : ", enc)

# iv = os.urandom(16)
a2 = AES256CBC(e2.get_derived_key(), iv)
dec = a2.decrpyt(enc)
print("Decrypted : ", dec)







0 comments on commit d5ad219

Please sign in to comment.