Table of Contents

Class PgpLiteralDataGenerator

Namespace
Org.BouncyCastle.Bcpg.OpenPgp
Assembly
BouncyCastle.Cryptography.dll
public class PgpLiteralDataGenerator : IStreamGenerator
Inheritance
PgpLiteralDataGenerator
Implements
Inherited Members

Remarks

Class for producing literal data packets.

Constructors

PgpLiteralDataGenerator()

public PgpLiteralDataGenerator()

PgpLiteralDataGenerator(bool)

Generates literal data objects in the old format. This is important if you need compatibility with PGP 2.6.x.

public PgpLiteralDataGenerator(bool oldFormat)

Parameters

oldFormat bool

If true, uses old format.

Fields

Binary

public const char Binary = 'b'

Field Value

char

Console

The special name indicating a "for your eyes only" packet.

public const string Console = "_CONSOLE"

Field Value

string

Text

public const char Text = 't'

Field Value

char

Utf8

public const char Utf8 = 'u'

Field Value

char

Methods

Close()

[Obsolete("Dispose any opened Stream directly")]
public void Close()

Open(Stream, char, FileInfo)

Open a literal data packet for the passed in FileInfo object, returning an output stream for saving the file contents.

The stream created can be closed off by either calling Close() on the stream or Close() on the generator. Closing the returned stream does not close off the Stream parameter outStr.

public Stream Open(Stream outStr, char format, FileInfo file)

Parameters

outStr Stream

The stream we want the packet in.

format char

The format we are using.

file FileInfo

The FileInfo object containg the packet details.

Returns

Stream

Open(Stream, char, string, DateTime, byte[])

Open a literal data packet, returning a stream to store the data inside the packet, as an indefinite length stream. The stream is written out as a series of partial packets with a chunk size determined by the size of the passed in buffer.

The stream created can be closed off by either calling Close() on the stream or Close() on the generator. Closing the returned stream does not close off the Stream parameter outStr.

Note: if the buffer is not a power of 2 in length only the largest power of 2 bytes worth of the buffer will be used.

public Stream Open(Stream outStr, char format, string name, DateTime modificationTime, byte[] buffer)

Parameters

outStr Stream

The stream we want the packet in.

format char

The format we are using.

name string

The name of the 'file'.

modificationTime DateTime

The time of last modification we want stored.

buffer byte[]

The buffer to use for collecting data to put into chunks.

Returns

Stream

Open(Stream, char, string, long, DateTime)

Open a literal data packet, returning a stream to store the data inside the packet.

The stream created can be closed off by either calling Close() on the stream or Close() on the generator. Closing the returned stream does not close off the Stream parameter outStr.

public Stream Open(Stream outStr, char format, string name, long length, DateTime modificationTime)

Parameters

outStr Stream

The stream we want the packet in.

format char

The format we are using.

name string

The name of the 'file'.

length long

The length of the data we will write.

modificationTime DateTime

The time of last modification we want stored.

Returns

Stream