Open
Description
Describe the bug
A file is encrypted in the same fashion as in EncryptMain. When trying to decrypt it using gpg --decrypt
command, got the following message:
gpg: [don't know]: 1st length byte missing
To Reproduce
Steps to reproduce the behavior (code sample)
public void encrypt(String plaintextFilePath, String encryptedFilePath,
String sender, String recipient)
throws PGPException, IOException, SignatureException, NoSuchAlgorithmException, NoSuchProviderException {
final InputStream input = Files.newInputStream(Path.of(plaintextFilePath));
final OutputStream output = BouncyGPG.encryptToStream()
.withConfig(keyringConfig)
.withStrongAlgorithms()
.toRecipient(recipient)
.andSignWith(sender)
.binaryOutput()
.andWriteTo(new BufferedOutputStream(Files.newOutputStream(Path.of(encryptedFilePath)), BUFFER_SIZE));
Streams.pipeAll(input, output);
output.flush();
output.close();
}
Expected behavior
File should be decrypted as expected.
** System (please complete the following information):**
For encryption
- Device: MacBook Pro
- OS: Linux
- Java: AdoptOpenJDK 11
- Version: 2.3.0
For decryption:
- Device: Google Cloud VM
- OS: RedHat Enterprise 8
- Java: n/a
- Version: n/a
- GPG: gpg (GnuPG) 2.2.20
Additional context
Add any other context about the problem here.
Metadata
Metadata
Assignees
Labels
No labels