summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-01-13 17:37:42 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-01-13 17:37:42 +0700
commitb98576ed15d0a923012052e262236c9d26d89d89 (patch)
treeec91791ee1bae7c5c6d09ec60eacb844b73d7713
parentHandle RevocationKey and RevocationReason (diff)
downloadBouncyCastle.NET-ed25519-b98576ed15d0a923012052e262236c9d26d89d89.tar.xz
Update IsMasterKey
-rw-r--r--crypto/src/openpgp/PgpPublicKey.cs7
1 files changed, 6 insertions, 1 deletions
diff --git a/crypto/src/openpgp/PgpPublicKey.cs b/crypto/src/openpgp/PgpPublicKey.cs
index 9b8a956f2..33fabc8aa 100644
--- a/crypto/src/openpgp/PgpPublicKey.cs
+++ b/crypto/src/openpgp/PgpPublicKey.cs
@@ -460,7 +460,12 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp
         /// <summary>True, if this could be a master key.</summary>
         public bool IsMasterKey
         {
-            get { return (subSigs == null) && !(this.IsEncryptionKey && publicPk.Algorithm != PublicKeyAlgorithmTag.RsaGeneral); }
+            get
+            {
+                // this might seem a bit excessive, but we're also trying to flag something can't be a master key.
+                return !(publicPk is PublicSubkeyPacket)
+                    && !(this.IsEncryptionKey && publicPk.Algorithm != PublicKeyAlgorithmTag.RsaGeneral);
+            }
         }
 
         /// <summary>The algorithm code associated with the public key.</summary>