EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElPGPWriter in a loop

Posted: 04/10/2013 13:36:34
by Daniel OConnell (Basic support level)
Joined: 04/10/2013
Posts: 1

This code doesn't work, the file is created and it looks like both files in d:\gpgTestFiles2 are merged into the encrypted file when looking at the size of the file, but when decrypting, only the first file is included.

Should this work?

string [] files = Directory.GetFiles(@"d:\gpgTestFiles2");
streamOutput=new FileStream(strOutputFilename, FileMode.Create);
foreach(string filename in files) {
    streamInput=new FileStream(filename, FileMode.Open);
    try {
        try {
            pgpWriter.Encrypt(streamInput, streamOutput, 0);
        catch(Exception ex) {
        finally {
    finally {
Posted: 04/10/2013 13:40:00
by Eugene Mayevski (Team)

No it should not. PGP format was designed to encrypt just one file into one encrypted file.

PGP Corporation introduced an extension (also supported by SecureBlackbox) to put multiple files in TAR archive and encrypt the TAR archive.

To do this you need to use EncryptFiles method.

Sincerely yours
Eugene Mayevski



Topic viewed 432 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!