-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Key Length issue #3
Comments
Hi @NTMS2017 As you researched, 1 utf-8 char is 4 bytes, so a 32 char length key is equals to 32 * 4 = 128 bits. So keys should have:
This can vary on the characters you are using I highly recommend you to use a 256 bits key generated by a CSPRNG. PointyCastle has one, it is used for the Salts in password. I will stick your issue to remember to add something like that in this project so you can generate cryptographic secure keys right from the terminal. Note: You already able to do that thought |
Thanks Leo, check all this tomorrow. |
First I use my key (Len:50) and I get below error. Error state that key must be 128/192 or 256bits.
I am confuse here. You have 32 character and its works.
https://stackoverflow.com/questions/4850241/how-many-bits-in-a-character has a explain that it depends what is the character and what encoding it is in. So do you going to support ISO-8895-1 tp ISO-8895-9 as well as, UTF-8, UTF-16, UTF-32 encoding type?
I will stick to 32 length now. My local language is TR and ISO-8895-5 (Latin-5 (Turkish)). It will be good to cover all other language. Thanks
Unhandled exception:
Invalid argument(s): Key length must be 128/192/256 bits
#0 AESFastEngine.init (package:pointycastle/block/aes_fast.dart:66:7)
#1 AES.encrypt (package:encrypt/src/aes.dart:20:9)
#2 Encrypter.encrypt (package:encrypt/encrypt.dart:17:17)
#3 main (file:///Users/niyazitoros/IdeaProjects/github/untitled/bin/main.dart:11:35)
#4 _startIsolate. (dart:isolate-patch/dart:isolate/isolate_patch.dart:279)
#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/dart:isolate/isolate_patch.dart:165)
The text was updated successfully, but these errors were encountered: