-
When piping the decrypt function into a const pubKey = await opengpg.readKey({armoredKey: publicKey});
const sourceStream = createReadStream(sourcePath);
const encrypted = await opengpg.encrypt({
message: await opengpg.createMessage({text: sourceStream}),
encryptionKeys: pubKey,
format: 'binary',
});
encrypted
.pipe(createWriteStream(outputPath + '.enc')) This gives me the desired file format. opengpg
.readMessage({
binaryMessage: sourceStream,
})
.then(async (M) => {
(
await opengpg.decrypt({
message: M,
decryptionKeys: pKey,
format: 'binary',
})
).data.pipe(outputStream); I get the output in the following format:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
After discussing this on gitter with @twiss, he mentioned the TypedArray#toString. Which in fact prints typed Arrays in that format: |
Beta Was this translation helpful? Give feedback.
-
Probably it comes from this code, when encrypting:
You're saying here that the input stream is text, so it gets treated as a string. That's where the Try message: await opengpg.createMessage({binary: sourceStream}), |
Beta Was this translation helpful? Give feedback.
Probably it comes from this code, when encrypting:
You're saying here that the input stream is text, so it gets treated as a string. That's where the
toString
comes from.Try