simple_rsa icon indicating copy to clipboard operation
simple_rsa copied to clipboard

FormatException: Bad UTF-8 encoding 0x81 (at offset 1)

Open fg2q1q3q opened this issue 6 years ago • 3 comments

hello,thanks for your open source。 I have some problems when use the package. eg:

  • String phone=await encryptString("12345678910", Utils.rsakey); When used in this way, the decryption result is not correct.

  • String phone=await encryptString("12345678910", utf8.decode(base64.decode(Utils.rsakey))); When used in this way, it can't run and the console reported the following error :

    FormatException: Bad UTF-8 encoding 0x81 (at offset 1)

development environment:

vscode flutter version: 1.0.0+1 dart environment: sdk: ">=2.0.0-dev.68.0 <3.0.0"

fg2q1q3q avatar Feb 14 '19 03:02 fg2q1q3q

Check out this https://github.com/giandifra/simple_rsa/issues/5#issuecomment-464449870, might be helpful.

riftninja avatar Feb 17 '19 12:02 riftninja

final encryptedText = await encryptString(asekey,utf8.decode(base64.decode(encryptionHelper.mPublicKey))); Same as yours, my publishkey is a string without '-----BEGIN PUBLIC KEY-----' and '-----END PUBLIC KEY-----', it can't run and the console reported the following error : Unhandled Exception: FormatException: Bad UTF-8 encoding 0x81 (at offset 1)

chao9267 avatar Dec 03 '19 11:12 chao9267

$ flutter doctor Doctor summary (to see all details, run flutter doctor -v): [√] Flutter (Channel stable, v1.9.1+hotfix.6, on Microsoft Windows [Version 6.1.7601], locale zh-CN) [√] Android toolchain - develop for Android devices (Android SDK version 29.0.2) [√] Android Studio (version 3.5) [√] Connected device (1 available)

chao9267 avatar Dec 03 '19 11:12 chao9267