summary refs log tree commit diff
path: root/crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2015-10-14 15:49:07 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2015-10-14 15:49:07 +0700
commitf98026821cb7dc9c11216eef53b8d714740aa078 (patch)
tree1891a7f8df1f2a85dc43c1caaaa3a17ed5ded9e2 /crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs
parentSupport "CMS" header (diff)
downloadBouncyCastle.NET-ed25519-f98026821cb7dc9c11216eef53b8d714740aa078.tar.xz
Fixed single line file handling
Diffstat (limited to 'crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs')
-rw-r--r--crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs28
1 files changed, 19 insertions, 9 deletions
diff --git a/crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs b/crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs

index 14fa37269..8e4f7a3b5 100644 --- a/crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs +++ b/crypto/test/src/openpgp/examples/ClearSignedFileProcessor.cs
@@ -124,6 +124,16 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Examples outStr.Write(lineSep, 0, lineSep.Length); } } + else + { + // a single line file + if (lookAhead != -1) + { + byte[] line = lineOut.ToArray(); + outStr.Write(line, 0, GetLengthWithoutSeparatorOrTrailingWhitespace(line)); + outStr.Write(lineSep, 0, lineSep.Length); + } + } outStr.Close(); @@ -333,19 +343,19 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Examples { if (args[0].Equals("-s")) { - Stream fis = File.OpenRead(args[2]); - Stream fos = File.Create(args[1] + ".asc"); + Stream fis = File.OpenRead(args[2]); + Stream fos = File.Create(args[1] + ".asc"); - Stream keyIn = PgpUtilities.GetDecoderStream(fis); + Stream keyIn = PgpUtilities.GetDecoderStream(fis); - string digestName = (args.Length == 4) - ? "SHA1" - : args[4]; + string digestName = (args.Length == 4) + ? "SHA1" + : args[4]; - SignFile(args[1], keyIn, fos, args[3].ToCharArray(), digestName); + SignFile(args[1], keyIn, fos, args[3].ToCharArray(), digestName); - fis.Close(); - fos.Close(); + fis.Close(); + fos.Close(); } else if (args[0].Equals("-v")) {