jerson / react-native-fast-openpgp

OpenPGP for react native made with golang for fast performance
https://www.npmjs.com/package/react-native-fast-openpgp
MIT License
45 stars 18 forks source link

openpgp: invalid data: tag byte does not have MSB set #89

Closed adigeo closed 1 year ago

adigeo commented 1 year ago

Hello,

I am using the latest version of the project.

Using the following code to decrypt a file locally stored:

await OpenPGP.decryptFile(file_path, file_path_decrypted, this.state.keys.private).then((content) => {
                    console.log('Decrypted file saved', file_path_decrypted);
                }).catch((error) => {
                    console.log('Decrypting file ', file_transfer.filename, ' error:', error);
                });

I get:

Decrypting file  FvH1wsSWIAYEwz1.jpeg.asc  error: Error: intResponse: openpgp: invalid data: tag byte does not have MSB set
    at Function._intResponse (index.tsx:713:13)
    at Function.decryptFile$ (index.tsx:265:17)
    at tryCatch (runtime.js:45:40)
    at Generator.invoke [as _invoke] (runtime.js:271:22)
    at prototype.<computed> [as next] (runtime.js:97:21)
    at tryCatch (runtime.js:45:40)
    at invoke (runtime.js:135:20)
    at runtime.js:145:13
    at tryCallOne (core.js:37:12)
    at core.js:123:15
adigeo commented 1 year ago

Self-solving the problem, the encryptFile and decryptFile functions do not output or read input from PGP-armored text files, calls to the armor/dearmor functions are missing in the underlying go library.

nguyenvanphuc2203 commented 9 months ago

hello @adigeo how to resolved this issue, a have same issue

adigeo commented 9 months ago

See https://github.com/AGProjects/sylk-mobile/blob/master/app/app.js

nguyenvanphuc2203 commented 9 months ago

See https://github.com/AGProjects/sylk-mobile/blob/master/app/app.js

hello please tell me your solution, my code same your file

nguyenvanphuc2203 commented 9 months ago

hi @adigeo i tried your solution format base_64 message work well with text file.json but i try with .zip file not work, any solution for zip file?