diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:47:32 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-06-29 14:47:32 +0700 |
commit | a395a34a769d3c7e6616129f4832b7014dbbfe98 (patch) | |
tree | 76a4749c2f548afff826c6758de3c8ce0b6fd646 /crypto/src/bcpg | |
parent | Generics migration complete (diff) | |
download | BouncyCastle.NET-ed25519-a395a34a769d3c7e6616129f4832b7014dbbfe98.tar.xz |
Cleanup NewLine handling
Diffstat (limited to 'crypto/src/bcpg')
-rw-r--r-- | crypto/src/bcpg/ArmoredOutputStream.cs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/crypto/src/bcpg/ArmoredOutputStream.cs b/crypto/src/bcpg/ArmoredOutputStream.cs index a3d86429c..4a726e2dd 100644 --- a/crypto/src/bcpg/ArmoredOutputStream.cs +++ b/crypto/src/bcpg/ArmoredOutputStream.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -91,7 +92,7 @@ namespace Org.BouncyCastle.Bcpg private string type; - private static readonly string nl = Platform.NewLine; + private static readonly string NewLine = Environment.NewLine; private static readonly string headerStart = "-----BEGIN PGP "; private static readonly string headerTail = "-----"; private static readonly string footerStart = "-----END PGP "; @@ -219,8 +220,8 @@ namespace Org.BouncyCastle.Bcpg throw new IOException("unknown hash algorithm tag in beginClearText: " + hashAlgorithm); } - DoWrite("-----BEGIN PGP SIGNED MESSAGE-----" + nl); - DoWrite("Hash: " + hash + nl + nl); + DoWrite("-----BEGIN PGP SIGNED MESSAGE-----" + NewLine); + DoWrite("Hash: " + hash + NewLine + NewLine); clearText = true; newLine = true; @@ -288,7 +289,7 @@ namespace Org.BouncyCastle.Bcpg break; } - DoWrite(headerStart + type + headerTail + nl); + DoWrite(headerStart + type + headerTail + NewLine); if (m_headers.TryGetValue(HeaderVersion, out var versionHeaders)) { @@ -307,7 +308,7 @@ namespace Org.BouncyCastle.Bcpg } } - DoWrite(nl); + DoWrite(NewLine); start = false; } @@ -318,7 +319,7 @@ namespace Org.BouncyCastle.Bcpg bufPtr = 0; if ((++chunkCount & 0xf) == 0) { - DoWrite(nl); + DoWrite(NewLine); } } @@ -367,7 +368,7 @@ namespace Org.BouncyCastle.Bcpg Encode(outStream, buf, bufPtr); } - DoWrite(nl + '='); + DoWrite(NewLine + '='); int crcV = crc.Value; @@ -377,11 +378,11 @@ namespace Org.BouncyCastle.Bcpg Encode(outStream, buf, 3); - DoWrite(nl); + DoWrite(NewLine); DoWrite(footerStart); DoWrite(type); DoWrite(footerTail); - DoWrite(nl); + DoWrite(NewLine); outStream.Flush(); } @@ -390,7 +391,7 @@ namespace Org.BouncyCastle.Bcpg string name, string v) { - DoWrite(name + ": " + v + nl); + DoWrite(name + ": " + v + NewLine); } private void DoWrite( |