Perhaps there is a python- & xojo-pro out there who simply can convert some python-lines to xojo?!
[code]from Crypto.Cipher import AES
from binascii import unhexlify
from Crypto.Protocol.KDF import PBKDF2
DDK = ‘DDK-String’
secret = PBKDF2(DDK, unhexlify(DDK), 16, 1000, None)
IV = unhexlify(DDK)
decipher = AES.new(secret, AES.MODE_CBC, IV)
decrypted = decipher.decrypt(base64.b64decode(‘encrypted token’)).decode(‘utf-8’)
token = decrypted[:36][/code]
To Xojo Code, the first try, but no idea if it’s right and how to continue
Dim strEncryptedText As String
Dim strKey As String = "123456789..."
Dim strIV As String = DecodeHex(strKey)
Dim hash As MemoryBlock
hash = Crypto.PBKDF2(strKey, DecodeHex(strEncryptedText), 1000, 16, crypto.HashAlgorithms.SHA256)
Ideas like this, but no solution yet …
Dim a as AESMBS
I believe you are on the correct path to convert the Python code to Xojo. Although libraries between languages are close, sometimes they are not close enough. In the past I found that I had to rewrite portions of the Python AES library to use the functions in Xojo. This way I knew that the two libraries and the files/data that was being sent and received worked flawlessly.
Try the built-in Xojo functions and see if they work, and if not you may need to rewrite some libraries. If your not in a rush, rewriting libraries helps learn the internal functions and algorithms.
Thank you for reply Eugene.
I had the same thought as you but time is always a big problem. I am sure I would find a solution if I had an hour or two to think about it and write it. I was just hoping a Python pro would see that and have the solution in a second
For now I made a workaround in PHP, that worked in minutes, but don’t makes me that happy, because it’s PHP and not XOJO
Thank you Erwin, I’ll take a look at it when I’m building the imap client, I think Chillcat has the best working solution for imap and perhaps there’s also a solution for the above conversion.