Possible BUG or misdocumentation

saturatio <[email protected]>
Newsgroups gmane.comp.encryption.bouncy-castle.devel
Message-ID <[email protected]>
Hi

Maybe I just misunderstand how it should work, but if you try to use the
buffer version of 

public static void writeFileToLiteralData(
        OutputStream out,
        char fileType,
        File file,
        byte[] buffer)
        throws IOException

It just fails if the file is too small. To test you can use the example 

https://github.com/bcgit/bc-java/blob/master/pg/src/main/java/org/bouncycastle/openpgp/examples/KeyBasedLargeFileProcessor.java

with a two line text file. It will fail silently, generating a wrong pgp
file. If you try to decrypt with command line gpg, it will have the contents
as the file name.

gpg --verbose -d outputfile.txt.pgp 
gpg: la clave pública es 37465DE215DE0CA0
gpg: cifrado con clave de 2048 bits RSA, ID 37465DE215DE0CA0, creada el
2018-10-08
      "[email protected]"
gpg: datos cifrados AES256
gpg: nombre fichero original='*\n\x09 * Version 2\n\x1b/**\n\x09 *
Versio\0\0\0\0\0\0\0\0\0\0\0'


Can this be considered a bug?

Saludos



--
Sent from: http://bouncy-castle.1462172.n4.nabble.com/Bouncy-Castle-Dev-f1462173.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.