AESENCRYPT help
Moderators: JRL, Dorian (MJT support)
AESENCRYPT help
Hi Marcus and everyone!
I am going a little crazy trying to match the encryption of aesencrypt...
I would like to use a web function that will follow the same encryption method so that MS can exchange encrypted text with it.
Using an online site to try to match up the function:
https://www.devglan.com/online-tools/ae ... decryption
As I understand, AESencrypt is taking the passkey entered, and applying SHA256 to it - but this creates a 64 byte string for the key. AES256 needs a 32 byte string?!?!
E.g: passkey of "hello world" becomes
B94D27B9934D3E08A52E52D7DA7DABFAC484EFE37A5380EE9088F7ACE2EFCDE9
Are you really using AES512 to accomodate a 64 byte key?
I am going a little crazy trying to match the encryption of aesencrypt...
I would like to use a web function that will follow the same encryption method so that MS can exchange encrypted text with it.
Using an online site to try to match up the function:
https://www.devglan.com/online-tools/ae ... decryption
As I understand, AESencrypt is taking the passkey entered, and applying SHA256 to it - but this creates a 64 byte string for the key. AES256 needs a 32 byte string?!?!
E.g: passkey of "hello world" becomes
B94D27B9934D3E08A52E52D7DA7DABFAC484EFE37A5380EE9088F7ACE2EFCDE9
Are you really using AES512 to accomodate a 64 byte key?
Re: AESENCRYPT help
or are you substringing the sha256 to grab 32 byte string? Or double substringing yo get the additional IV string? 

- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: AESENCRYPT help
Hi Tony,
I'm looking into this right now for you.
I'm looking into this right now for you.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: AESENCRYPT help
I wonder if the size difference we are seeing here is because of Unicode. Macro Scheduler is using Unicode. Perhaps we need a way to specify the character encoding.
However, I've now tried three different online AES128 SHA256 CBC encryption/decryption tools and they all give different answers, so ....
However, I've now tried three different online AES128 SHA256 CBC encryption/decryption tools and they all give different answers, so ....

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: AESENCRYPT help
Thanks Marcus!
I will research unicode encryption.
At least I can focus on AES128.
But can you confirm you are passing all 64 characters of the sha256? Maybe that means utf32 is the unicode set? 4x of utf8 and 64 chars of sha256 is 4x of the 16 charts required for key of AES128....
Ow... brain.... hurts...
I will research unicode encryption.
At least I can focus on AES128.
But can you confirm you are passing all 64 characters of the sha256? Maybe that means utf32 is the unicode set? 4x of utf8 and 64 chars of sha256 is 4x of the 16 charts required for key of AES128....
Ow... brain.... hurts...
Re: AESENCRYPT help
Hmmmmmm. reading more AES128 can only have 128bits in the key even if source text is unicode?
so how can sha 256bit be used as the key?
so how can sha 256bit be used as the key?
Re: AESENCRYPT help
Oh wait Alex - I just reread your message -
You said you are using AES128 CBC - does that mean you are using an IV (initialization vector)?
Like you use 16 bytes of a substring of the SHA256 for the key, and another 16 byte substring for the IV?
Anything you can help me to understand what pieceof the SHA256 64 byte string you use would be awesome - Then I can use Hash> with SHA256 and substring/length to get the correct ascii key... I saw how C and Delphi will length the SHA256 to derive a key
(https://stackoverflow.com/questions/918 ... crypt-in-c)
so I would assume you are doing the same?
I was able to get two sites to match CBC output:
SOURCE TEXT:
Now is the time to encryptWe will use AES encryption now!I change function to better standard which is SHA256 hashed encryptionThen I am using BASE64 to make the binary encryption into unicode text.Now is the time to encryptWe will use AES encryption now!
KEY:
1234567890123456
https://www.devglan.com/online-tools/ae ... decryption
AES128 - CBC - (no IV option)
RESULT:
7MeJD7kGc9XbfBDC0U3k3JHvtmerPswKmR5WiUMPHrMZ1TwnOsFEOtLO93KamkH/bYCmWn0GeHJ9FEPdv/xvAGit4NHV7cZ6t//xi3xdpcpssyYNid1EMdM154ULi5R1pNs/yslDKN8iQjjuEgL75NOV7i4jd7eTcPd9bi1S8mncatATrodHtSPOSeXTJYwLJVuaENEuHon0BPGyYZLoT7ftV6zB3Q1oexsTrUpSqectZdB/Iy5bVqNzaX3OA2e41xY0lJ2VOLke4UrUXTk0G+pAd5UcrrvoiAyye0BrZfNVMj4n3S92wEiI3lZtyWUr4WlufKAeCyfNbRZYcQeHLw==
https://encode-decode.com/aes128-encrypt-online/
AES128 (assume background is CBC no IV)
7MeJD7kGc9XbfBDC0U3k3JHvtmerPswKmR5WiUMPHrMZ1TwnOsFEOtLO93KamkH/bYCmWn0GeHJ9FEPdv/xvAGit4NHV7cZ6t//xi3xdpcpssyYNid1EMdM154ULi5R1pNs/yslDKN8iQjjuEgL75NOV7i4jd7eTcPd9bi1S8mncatATrodHtSPOSeXTJYwLJVuaENEuHon0BPGyYZLoT7ftV6zB3Q1oexsTrUpSqectZdB/Iy5bVqNzaX3OA2e41xY0lJ2VOLke4UrUXTk0G+pAd5UcrrvoiAyye0BrZfNVMj4n3S92wEiI3lZtyWUr4WlufKAeCyfNbRZYcQeHLw==
MSCHED AESEncrypt output (after Base64) using same key in password:
QnbYykYOINF8I06XpTwo76a+DNOuOX4dPmCJBW3UsTa/P1bhAvyHQLYfb2Mp2sSrjPco9MBfWkURJXuX6Q3t+hULmQmTkxRWVg/YR73XgVEfuMKvfMwFvDbyQdHroifpa42fgEZ2jx2VL9w6dR7TcJQn0CRjLZwn4oNkBetzeSEGX2RgkXrgDWZl50Khz+vkMdhT64igJSXO/wWKjA6rRcCJcYwO08k+9JCbMLmx6eBULniB2DkO0i7TL3hvm6PIX7Img1Cj9thxh7ykEoEhuaDZfXvLf9G7l+YuthWszDTLTCJL4V8RoOlp4v21ZC7Lnr4xGC3uYLr/+U1Y7zGv8DNqGcAwRoQhlKDYtqSN8AgZQyiKwuiZE+Q9OXskK3HA4x6bRR7eBZEB5peAlMmBImCn/l7RnRAgpNScDfB4Kf4+8ffWZrhm05IqI1KVoa2d5Jg1EtXiREmyLXmUe+lv4bGAfS/OASwtzBehBb04QwZVXFyrBs/NDn2yOaJxioI7rIKbZYZAYlnXmIhd0TRCR/74Qs4wU2UPwZdPiyAy8md7tIwNL8WqImO6ZB8DKNs1T2VLLQ7zCh2C0iUftAKAFihQggoBYX3v2bAbQWx+eHjcDxLy3oEi2cpRnkPvE/pz2rD6HLksbvKOdrFKhbTftQWWxgsnDToAihC4VVbC
You said you are using AES128 CBC - does that mean you are using an IV (initialization vector)?
Like you use 16 bytes of a substring of the SHA256 for the key, and another 16 byte substring for the IV?
Anything you can help me to understand what pieceof the SHA256 64 byte string you use would be awesome - Then I can use Hash> with SHA256 and substring/length to get the correct ascii key... I saw how C and Delphi will length the SHA256 to derive a key
(https://stackoverflow.com/questions/918 ... crypt-in-c)
so I would assume you are doing the same?
I was able to get two sites to match CBC output:
SOURCE TEXT:
Now is the time to encryptWe will use AES encryption now!I change function to better standard which is SHA256 hashed encryptionThen I am using BASE64 to make the binary encryption into unicode text.Now is the time to encryptWe will use AES encryption now!
KEY:
1234567890123456
https://www.devglan.com/online-tools/ae ... decryption
AES128 - CBC - (no IV option)
RESULT:
7MeJD7kGc9XbfBDC0U3k3JHvtmerPswKmR5WiUMPHrMZ1TwnOsFEOtLO93KamkH/bYCmWn0GeHJ9FEPdv/xvAGit4NHV7cZ6t//xi3xdpcpssyYNid1EMdM154ULi5R1pNs/yslDKN8iQjjuEgL75NOV7i4jd7eTcPd9bi1S8mncatATrodHtSPOSeXTJYwLJVuaENEuHon0BPGyYZLoT7ftV6zB3Q1oexsTrUpSqectZdB/Iy5bVqNzaX3OA2e41xY0lJ2VOLke4UrUXTk0G+pAd5UcrrvoiAyye0BrZfNVMj4n3S92wEiI3lZtyWUr4WlufKAeCyfNbRZYcQeHLw==
https://encode-decode.com/aes128-encrypt-online/
AES128 (assume background is CBC no IV)
7MeJD7kGc9XbfBDC0U3k3JHvtmerPswKmR5WiUMPHrMZ1TwnOsFEOtLO93KamkH/bYCmWn0GeHJ9FEPdv/xvAGit4NHV7cZ6t//xi3xdpcpssyYNid1EMdM154ULi5R1pNs/yslDKN8iQjjuEgL75NOV7i4jd7eTcPd9bi1S8mncatATrodHtSPOSeXTJYwLJVuaENEuHon0BPGyYZLoT7ftV6zB3Q1oexsTrUpSqectZdB/Iy5bVqNzaX3OA2e41xY0lJ2VOLke4UrUXTk0G+pAd5UcrrvoiAyye0BrZfNVMj4n3S92wEiI3lZtyWUr4WlufKAeCyfNbRZYcQeHLw==
MSCHED AESEncrypt output (after Base64) using same key in password:
QnbYykYOINF8I06XpTwo76a+DNOuOX4dPmCJBW3UsTa/P1bhAvyHQLYfb2Mp2sSrjPco9MBfWkURJXuX6Q3t+hULmQmTkxRWVg/YR73XgVEfuMKvfMwFvDbyQdHroifpa42fgEZ2jx2VL9w6dR7TcJQn0CRjLZwn4oNkBetzeSEGX2RgkXrgDWZl50Khz+vkMdhT64igJSXO/wWKjA6rRcCJcYwO08k+9JCbMLmx6eBULniB2DkO0i7TL3hvm6PIX7Img1Cj9thxh7ykEoEhuaDZfXvLf9G7l+YuthWszDTLTCJL4V8RoOlp4v21ZC7Lnr4xGC3uYLr/+U1Y7zGv8DNqGcAwRoQhlKDYtqSN8AgZQyiKwuiZE+Q9OXskK3HA4x6bRR7eBZEB5peAlMmBImCn/l7RnRAgpNScDfB4Kf4+8ffWZrhm05IqI1KVoa2d5Jg1EtXiREmyLXmUe+lv4bGAfS/OASwtzBehBb04QwZVXFyrBs/NDn2yOaJxioI7rIKbZYZAYlnXmIhd0TRCR/74Qs4wU2UPwZdPiyAy8md7tIwNL8WqImO6ZB8DKNs1T2VLLQ7zCh2C0iUftAKAFihQggoBYX3v2bAbQWx+eHjcDxLy3oEi2cpRnkPvE/pz2rD6HLksbvKOdrFKhbTftQWWxgsnDToAihC4VVbC
Re: AESENCRYPT help
One last thing - I noticed that the unicode is UTF-16LE rather than UTF-16- I don't think that is causing the mismatch but.....
Re: AESENCRYPT help
A HUGE THANK YOU to Marcus for tweaking the AES encryption and solved all my problems!!!
Now Macroscheduler can encrypt to NSA standards!!!
Now Macroscheduler can encrypt to NSA standards!!!

- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: AESENCRYPT help
No problem, and thanks for your help.
Macro Scheduler 14.4.09 with improved AESEncrypt function is now available.
Macro Scheduler 14.4.09 with improved AESEncrypt function is now available.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?