EldoS | Feel safer!

Software components for data protection, secure storage and transfer

TElPGPWriter in a loop

Also by EldoS: CallbackFilter
A component to monitor and control disk activity, track file and directory operations (create, read, write, rename etc.), alter file data, encrypt files, create virtual files.
#24554
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?

Code
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) {
            MessageBox.Show(ex.Message);
        }
        finally {
        }
    }
    finally {
        streamInput.Close();
    }
}
streamOutput.Close();
#24556
Posted: 04/10/2013 13:40:00
by Eugene Mayevski (EldoS Corp.)

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

Reply

Statistics

Topic viewed 377 times

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




|

Back to top

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

Got it!