![]() |
#1 |
Junior Member
Join Date: Mar 2018
Posts: 8
|
NsisCrypt plugin with AES128 algorithm
Hi all,
I try to use EncryptSymmetric function with aes128 algorithm, but getting an error: "Erro while trying to import key, consider your base64 string! Error Code: 80090008". It looks like problem with "base64 encoded key" or "base64 encoded iv" I used. Tell me how can I prepare these params from text string (ex. key "123", iv "456"). Thank you. |
![]() |
![]() |
![]() |
#2 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
Show how you are calling the plug-in! Looking at the Wiki, it does seem like you should base64 encode the key and IV.
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Mar 2018
Posts: 8
|
code: Im newbie in encryption and nsis. Therefore I tried and this code: code: And just in case tried this one: code: And all trys has one result with error message. I use callansi plugin as opposed to normal way after I visited many forums and only one site told me how to solve other error with unknown chinese words. With option ascii I had another results of functions but with no victory. |
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Mar 2018
Posts: 8
|
With another keystring and ivstring I had the same no result.
|
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: Mar 2018
Posts: 8
|
code: Im newbie in encryption and nsis. Therefore I tried and this code: code: And just in case tried this one: code: And all trys has one result with error message. I use callansi plugin as opposed to normal way after I visited many forums and only one site told me how to solve other error with unknown chinese words. With option ascii I had another results of functions but with no victory. |
![]() |
![]() |
![]() |
#6 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
You should focus on making it work in a ANSI installer first, then you can deal with Unicode later.
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#7 |
Junior Member
Join Date: Mar 2018
Posts: 8
|
Ok, I did it. Set Unicode to false. Unfortunately I still have an error "Erro while trying to import key, consider your base64 string! Error Code: 80090008"
|
![]() |
![]() |
![]() |
#8 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
3DES works correctly but AES does not because the plug-in does not use PROV_RSA_AES in the symmetric functions.
After taking a look at the code I'd say the whole thing requires a rewrite, it is leaking memory and does not support Unicode. IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#9 | |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
I played around a bit with a different plug-in and it seems to work:
Quote:
The input key is transformed with CryptDeriveKey:SHA1 unless you use the b64 type. AES is AES CBC with padding. IntOp $PostCount $PostCount + 1 |
|
![]() |
![]() |
![]() |
#10 | |
Junior Member
Join Date: Mar 2018
Posts: 8
|
Hi, Anders. Thanks very much for your reply. I tried to solve with your plugin and code. But results are different( I should get the same, because application on the server side use same algo. What do dou think about compatibility with your solution?
I implemented solution like that. I use vbs script to get correct result. But I think it's bad way, because I'm passing secret key and vector via args((( Quote:
Thanks a lot for your care. |
|
![]() |
![]() |
![]() |
#11 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
1) You are hashing the key and IV with MD5. The plug-in uses SHA1 on the key but it does allow you to specify base64 strings as input instead (see the 2nd Crypto::Decrypt call in my example above).
2) The plug-in does not support UTF-8. It only supports ANSI and UTF-16LE. Base64 can be used as a workaround. 3) I have no idea what GetBytes_4 in your code actually does. IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
#12 |
Moderator
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,176
|
PHP Code:
IntOp $PostCount $PostCount + 1 |
![]() |
![]() |
![]() |
|
Tags |
aes, nsis, nsiscrypt |
Thread Tools | Search this Thread |
Display Modes | |
|
|