Discuss this help topic in SecureBlackbox Forum

Work with streams

Working with streams in OpenPGPBlackbox is no different to the way you use streams in other SecureBlackbox or third-party components. You create stream objects of the needed type (MemoryStream, FileStream etc.) and pass them to the input of OpenPGPBlackbox components, e.g.:

FileStream pubFS = new FileStream(@"D:\keys\pubring.pkr", FileMode.Open);
try
{
    FileStream secFS = new FileStream(@"D:\keys\secring.skr", FileMode.Open);
    try
    {
        keyring.Load(pubFS, secFS, true);
    }
    finally
    {
        secFS.Close();
    }
}
finally
{
    pubFS.Close();
}

TElPGPWriter and TElPGPReader support work with non-seekable streams (i.e. streams for which position and length parameters are not known beforehand, such as network or database streams). If you need to pass such stream to TElPGPReader or TElPGPWriter, set the corresponding object's UndefInputLength property to true, and it won't attempt to read its position and length. Note that OnProgress event will report -1 as its Total parameter in this case.

How To articles about file encryption and signing with OpenPGP

Discuss this help topic in SecureBlackbox Forum