From b98576ed15d0a923012052e262236c9d26d89d89 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Thu, 13 Jan 2022 17:37:42 +0700 Subject: Update IsMasterKey --- crypto/src/openpgp/PgpPublicKey.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 /// True, if this could be a master key. 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); + } } /// The algorithm code associated with the public key. -- cgit 1.4.1