summary refs log tree commit diff
path: root/crypto/test/src/openpgp
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2020-04-05 18:34:12 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2020-04-05 18:34:12 +0700
commitb825f8f5fb199bd163a4ffe2cd4e999e4a0ba045 (patch)
tree864b9f257a6174b461b4952d6aefccd6ba802296 /crypto/test/src/openpgp
parentImprove SigAlgName for certs/CRLs (diff)
downloadBouncyCastle.NET-ed25519-b825f8f5fb199bd163a4ffe2cd4e999e4a0ba045.tar.xz
Support headers with multiple values
- tidy up test names
Diffstat (limited to 'crypto/test/src/openpgp')
-rw-r--r--crypto/test/src/openpgp/test/PGPArmoredTest.cs32
-rw-r--r--crypto/test/src/openpgp/test/PGPDSATest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPPBETest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPPacketTest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPRSATest.cs2
-rw-r--r--crypto/test/src/openpgp/test/PGPSignatureTest.cs2
7 files changed, 37 insertions, 7 deletions
diff --git a/crypto/test/src/openpgp/test/PGPArmoredTest.cs b/crypto/test/src/openpgp/test/PGPArmoredTest.cs
index e48827a35..f78165d5a 100644
--- a/crypto/test/src/openpgp/test/PGPArmoredTest.cs
+++ b/crypto/test/src/openpgp/test/PGPArmoredTest.cs
@@ -124,6 +124,35 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 			}
 		}
 
+        private void repeatHeaderTest()
+        {
+            MemoryStream bOut = new MemoryStream();
+            ArmoredOutputStream aOut = new ArmoredOutputStream(bOut);
+
+            aOut.SetHeader("Comment", "Line 1");
+            aOut.AddHeader("Comment", "Line 2");
+
+            aOut.Write(sample, 0, sample.Length);
+
+            aOut.Close();
+
+            MemoryStream bIn = new MemoryStream(bOut.ToArray(), false);
+            ArmoredInputStream aIn = new ArmoredInputStream(bIn, true);
+
+            string[] hdrs = aIn.GetArmorHeaders();
+            int count = 0;
+
+            for (int i = 0; i != hdrs.Length; i++)
+            {
+                if (hdrs[i].IndexOf("Comment: ") == 0)
+                {
+                    count++;
+                }
+            }
+
+            IsEquals(2, count);
+        }
+
 		public override void PerformTest()
 		{
 			//
@@ -258,7 +287,8 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
 			blankLineTest();
             pgpUtilTest();
-		}
+            repeatHeaderTest();
+        }
 
 		public override string Name
 		{
diff --git a/crypto/test/src/openpgp/test/PGPDSATest.cs b/crypto/test/src/openpgp/test/PGPDSATest.cs
index 7808ed6cd..e1dc384db 100644
--- a/crypto/test/src/openpgp/test/PGPDSATest.cs
+++ b/crypto/test/src/openpgp/test/PGPDSATest.cs
@@ -577,7 +577,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
 		public override string Name
         {
-			get { return "PGPDSATest"; }
+			get { return "PgpDsaTest"; }
         }
 
 		public static void Main(
diff --git a/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs b/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs
index 8f702b67b..222b50a4b 100644
--- a/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs
+++ b/crypto/test/src/openpgp/test/PGPNoPrivateKeyTest.cs
@@ -149,7 +149,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
         public override string Name
         {
-            get { return "PGPNoPrivateKeyTest"; }
+            get { return "PgpNoPrivateKeyTest"; }
         }
 
         public static void Main(
diff --git a/crypto/test/src/openpgp/test/PGPPBETest.cs b/crypto/test/src/openpgp/test/PGPPBETest.cs
index 29b786a83..eee3aaa63 100644
--- a/crypto/test/src/openpgp/test/PGPPBETest.cs
+++ b/crypto/test/src/openpgp/test/PGPPBETest.cs
@@ -364,7 +364,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
 		public override string Name
         {
-			get { return "PGPPBETest"; }
+			get { return "PgpPbeTest"; }
         }
 
 		public static void Main(
diff --git a/crypto/test/src/openpgp/test/PGPPacketTest.cs b/crypto/test/src/openpgp/test/PGPPacketTest.cs
index b82f8526f..b3dbbc2ed 100644
--- a/crypto/test/src/openpgp/test/PGPPacketTest.cs
+++ b/crypto/test/src/openpgp/test/PGPPacketTest.cs
@@ -60,7 +60,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
 		public override string Name
         {
-			get { return "PGPPacketTest"; }
+			get { return "PgpPacketTest"; }
         }
 
 		public static void Main(
diff --git a/crypto/test/src/openpgp/test/PGPRSATest.cs b/crypto/test/src/openpgp/test/PGPRSATest.cs
index 82b569bbb..be111c958 100644
--- a/crypto/test/src/openpgp/test/PGPRSATest.cs
+++ b/crypto/test/src/openpgp/test/PGPRSATest.cs
@@ -1213,7 +1213,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
         public override string Name
         {
-            get { return "PGPRSATest"; }
+            get { return "PgpRsaTest"; }
         }
 
         public static void Main(
diff --git a/crypto/test/src/openpgp/test/PGPSignatureTest.cs b/crypto/test/src/openpgp/test/PGPSignatureTest.cs
index af490193a..d2f4a8a31 100644
--- a/crypto/test/src/openpgp/test/PGPSignatureTest.cs
+++ b/crypto/test/src/openpgp/test/PGPSignatureTest.cs
@@ -1066,7 +1066,7 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp.Tests
 
         public override string Name
         {
-            get { return "PGPSignatureTest"; }
+            get { return "PgpSignatureTest"; }
         }
 
         public static void Main(