diff options
Diffstat (limited to 'crypto/src/bcpg/ArmoredOutputStream.cs')
-rw-r--r-- | crypto/src/bcpg/ArmoredOutputStream.cs | 51 |
1 files changed, 24 insertions, 27 deletions
diff --git a/crypto/src/bcpg/ArmoredOutputStream.cs b/crypto/src/bcpg/ArmoredOutputStream.cs index 7ee26886a..b3a32c6f5 100644 --- a/crypto/src/bcpg/ArmoredOutputStream.cs +++ b/crypto/src/bcpg/ArmoredOutputStream.cs @@ -97,7 +97,8 @@ namespace Org.BouncyCastle.Bcpg private static readonly string footerStart = "-----END PGP "; private static readonly string footerTail = "-----"; - private static readonly string version = "BCPG C# v" + AssemblyInfo.Version; + private static readonly string version = "BCPG C# v" + + Assembly.GetExecutingAssembly().GetName().Version; private readonly IDictionary headers; @@ -276,43 +277,39 @@ namespace Org.BouncyCastle.Bcpg } /** - * <b>Note</b>: Dispose does nor Dispose the underlying stream. So it is possible to write + * <b>Note</b>: close does nor close the underlying stream. So it is possible to write * multiple objects using armoring to a single stream. */ - protected override void Dispose(bool disposing) + public override void Close() { - if (disposing) + if (type != null) { - if (type != null) - { - if (bufPtr > 0) - { - Encode(outStream, buf, bufPtr); - } + if (bufPtr > 0) + { + Encode(outStream, buf, bufPtr); + } - DoWrite(nl + '='); + DoWrite(nl + '='); - int crcV = crc.Value; + int crcV = crc.Value; - buf[0] = ((crcV >> 16) & 0xff); - buf[1] = ((crcV >> 8) & 0xff); - buf[2] = (crcV & 0xff); + buf[0] = ((crcV >> 16) & 0xff); + buf[1] = ((crcV >> 8) & 0xff); + buf[2] = (crcV & 0xff); - Encode(outStream, buf, 3); + Encode(outStream, buf, 3); - DoWrite(nl); - DoWrite(footerStart); - DoWrite(type); - DoWrite(footerTail); - DoWrite(nl); - - outStream.Flush(); + DoWrite(nl); + DoWrite(footerStart); + DoWrite(type); + DoWrite(footerTail); + DoWrite(nl); - type = null; - start = true; - } + outStream.Flush(); - base.Dispose(disposing); + type = null; + start = true; + base.Close(); } } |