encrypt
encrypt copied to clipboard
how to handle spaces ?
Generating keys as follow
var key = encrypt.Key.fromUtf8(aesKey);
var iv = encrypt.IV.fromLength(16);
final encrypter = encrypt.Encrypter(encrypt.AES(key, padding: null));
final code = encrypter
.encrypt(myString, iv: iv)
.base64;
I notice that regularly, a code will be generated with a space in it, eg MjvmDDtmCLTg AxL1GrBVK4Ns1vKtm/qtwARv5fyWBPHWg==
In that case, the following code breaks:
encrypt.Encrypted.fromBase64(code)
traceback
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following FormatException was thrown building Builder(dirty):
Invalid character (at character 13)
MjvmDDtmCLTg AxL1GrBVK4Ns1vKtm/qtwARv5fyWBPHWg==
^
What is the proper resolution in this case ?
@leocavalcante hi Leo, this error occurs quite frequently for me, so I'm assuming this is not a library bug but something I did wrong ? Do you have any idea what could cause this "Invalid character" error and how I could resolve it ?
@leocavalcante is the project not maintained anymore ?