joeFischetti / Shibboleth-IdP3-TOTP-Auth

Fork of the totp project by korteke to implement totp in the MFA flow
Other
3 stars 4 forks source link

Modify encryption/decryption cipher #1

Closed joeFischetti closed 4 years ago

joeFischetti commented 4 years ago

I used blowfish in the default mode for Java which pads the ciphertext. While it technically works with other implementations, I tried writing something in python and the padding screws up the decryption. It's right, but the plaintext code is padded. And the ciphertext that python blowfish_ecb generates isn't the same. Example: ./decrypt.py Orig plaintext: YWNICQBDRKPGLHWN Orig ciphertext: 625BBAEA057BF2551AB4C9319A18649E7E83056FB0668CC6 Decrypted: b'YWNICQBDRKPGLHWN\x08\x08\x08\x08\x08\x08\x08\x08' Encrypted: 625bbaea057bf2551ab4c9319a18649e

joeFischetti commented 4 years ago

Revisiting... The encrypted version in my above example is only wrong because the plaintext wasn't padded. When padded correctly (using PKCS#7, I get the same results.)