github added clearing of buffer at end of literal data copy.
import org.bouncycastle.bcpg.MPInteger;
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
import org.bouncycastle.bcpg.SymmetricKeyAlgorithmTags;
+import org.bouncycastle.util.Arrays;
import org.bouncycastle.util.encoders.Base64;
import org.bouncycastle.util.encoders.DecoderException;
@@ -282,7 +283,7 @@ public static void writeFileToLiteralData(
{
PGPLiteralDataGenerator lData = new PGPLiteralDataGenerator();
OutputStream pOut = lData.open(out, fileType, file);
- pipeFileContents(file, pOut, new byte[4096]);
+ pipeFileContents(file, pOut, new byte[32768]);
}
/**
@@ -321,8 +322,18 @@ private static void pipeFileContents(File file, OutputStream pOut, byte[] buf)
}
pOut.close();
- } finally {
- try { in.close(); } catch (IOException ignored) { /* */ }
+ }
+ finally
+ {
+ Arrays.fill(buf, (byte)0);
+ try
+ {
+ in.close();
+ }
+ catch (IOException ignored)
+ {
+ // ignore...
+ }
}
}
