jerson / flutter-openpgp

OpenPGP for flutter made with golang for fast performance with support for android, ios, macos, linux, windows, web and hover
https://pub.dev/packages/openpgp
MIT License
67 stars 23 forks source link

armorDecode or something #62

Closed michep closed 1 year ago

michep commented 1 year ago

Hello,

I have to encode and later - decode a binary file into and from armored (ASCII) message format.

For encoding I do:

Future<String?> encryptBinary(Uint8List data) async {
    var encoded = await OpenPGP.encryptBytes(data, pubKey);
    return OpenPGP.armorEncode(encoded);
}

But for decoding a String into binary ther is no way - there is no armorDecode() function or something.

Is there any way I can do it?

jerson commented 1 year ago

Hi @michep thanks for report this, I think can implement that on the next version

jerson commented 1 year ago

amorDecode was introduced in v3.7.1, there is a new function signature for encode as well, allowing set a different message type


    var armorEncoded = await OpenPGP.armorEncode("PGP MESSAGE", bytesSample);
    var result = await OpenPGP.armorDecode(armorEncoded);

for now I'm closing this issue, but feel free to open if something is not working as expected