Skip to content

Commit

Permalink
replaced PyCrypto with pycryptodome fork
Browse files Browse the repository at this point in the history
  • Loading branch information
dnet committed Feb 1, 2024
1 parent dcb804c commit 58bd5bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions standalone/jwt_forgery.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from gmpy2 import mpz,gcd,c_div
import binascii
from Crypto.Hash import SHA256, SHA384, SHA512
from Crypto.Signature import PKCS1_v1_5 # god bless http://ratmirkarabut.com/articles/ctf-writeup-google-ctf-quals-2017-rsa-ctf-challenge/
from Crypto.Signature import pkcs1_15 # god bless http://ratmirkarabut.com/articles/ctf-writeup-google-ctf-quals-2017-rsa-ctf-challenge/
import asn1tools
import binascii
import time
Expand Down Expand Up @@ -76,11 +76,11 @@ def forge_mac(jwt0, public_key):

jks0_input = ".".join(jwt0.split('.')[0:2])
hash_0=HASH.new(jks0_input.encode('ascii'))
padded0 = PKCS1_v1_5.EMSA_PKCS1_V1_5_ENCODE(hash_0, len(jwt0_sig_bytes))
padded0 = pkcs1_15._EMSA_PKCS1_V1_5_ENCODE(hash_0, len(jwt0_sig_bytes))

jks1_input = ".".join(jwt1.split('.')[0:2])
hash_1=HASH.new(jks1_input.encode('ascii'))
padded1 = PKCS1_v1_5.EMSA_PKCS1_V1_5_ENCODE(hash_1, len(jwt0_sig_bytes))
padded1 = pkcs1_15._EMSA_PKCS1_V1_5_ENCODE(hash_1, len(jwt0_sig_bytes))

m0 = bytes2mpz(padded0)
m1 = bytes2mpz(padded1)
Expand Down
2 changes: 1 addition & 1 deletion standalone/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ diskcache==5.2.1
gmpy2==2.1.2
prompt-toolkit==3.0.14
pycparser==2.20
pycrypto==2.6.1
pycryptodome==3.20.0
pyparsing==2.4.7
six==1.15.0
wcwidth==0.2.5

0 comments on commit 58bd5bd

Please sign in to comment.