summary refs log tree commit diff
path: root/crypto/src/openpgp/PgpSecretKeyRingBundle.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-10-12 17:27:28 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-10-12 17:27:28 +0700
commitc5065a21286ce0755cee38118b1e288898456f7e (patch)
treee641ffbe5f561c130c39231dd5ee7f4351e03d35 /crypto/src/openpgp/PgpSecretKeyRingBundle.cs
parentcompleted copy constructor in SignerInformation, fixed mutable issue for SET ... (diff)
downloadBouncyCastle.NET-ed25519-c5065a21286ce0755cee38118b1e288898456f7e.tar.xz
Marker packet skipping
Diffstat (limited to 'crypto/src/openpgp/PgpSecretKeyRingBundle.cs')
-rw-r--r--crypto/src/openpgp/PgpSecretKeyRingBundle.cs7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/src/openpgp/PgpSecretKeyRingBundle.cs b/crypto/src/openpgp/PgpSecretKeyRingBundle.cs
index c9f4d3959..26be9c10b 100644
--- a/crypto/src/openpgp/PgpSecretKeyRingBundle.cs
+++ b/crypto/src/openpgp/PgpSecretKeyRingBundle.cs
@@ -48,12 +48,13 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
 
 			foreach (object obj in e)
 			{
-				PgpSecretKeyRing pgpSecret = obj as PgpSecretKeyRing;
+                // Marker packets must be ignored
+                if (obj is PgpMarker)
+                    continue;
 
+                PgpSecretKeyRing pgpSecret = obj as PgpSecretKeyRing;
 				if (pgpSecret == null)
-				{
 					throw new PgpException(Platform.GetTypeName(obj) + " found where PgpSecretKeyRing expected");
-				}
 
 				long key = pgpSecret.GetPublicKey().KeyId;
 				secretRings.Add(key, pgpSecret);