EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Open PGP fails with non seekable stream

Posted: 09/28/2009 11:33:06
by Allister Green (Standard support level)
Joined: 10/10/2008
Posts: 6

I am attempting to use the TElPGPWriter to encrypt a stream. This works fine if the stream is a simple filestream, but if I pass it a stream that is not seekable it fails as it attempts to call the Length property on the source stream.

If for example the source stream is a compressed stream this will fail as the length of the stream will not be known until all the data has been processed.

Is there any way to make this work?
Posted: 09/28/2009 11:50:01
by Eugene Mayevski (Team)

Yes, copy the source stream to memory or temporary file.

Sincerely yours
Eugene Mayevski
Posted: 09/28/2009 14:39:59
by Allister Green (Standard support level)
Joined: 10/10/2008
Posts: 6

Copying the source stream to memory is not an option as I want to use a Stream to minimise the amount of memory I use. Likewise, writing to a temporary file doesn't seem an appropriate or scalable approach either.

In general the streaming model allows for streams to wrap streams to achieve multiple transforms within a single operation. Is there any way for the PGPWriter to not require the use of the Length property? Can it not just read from the stream until it reaches the end?
Posted: 09/28/2009 23:52:03
by Ken Ivanov (Team)

I am not sure if it is technically possible at all according to OpenPGP specification. Each OpenPGP data packet must be prefixed with encoded length of the processed data, so knowing the length is required to process the data. Mykola will correct me if I am wrong.
Posted: 09/29/2009 03:25:43
by Mykola Olshevsky (Basic support level)
Joined: 07/07/2005
Posts: 442

OpenPGP specification allows such functionality (there is special case of packet size - 'partial', which allows to write PGP packets without knowing the exact length). So, I assume, we will consider adding such feature to OpenPGPBlackbox.



Topic viewed 1278 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!