diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-01-13 17:37:42 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-01-13 17:37:42 +0700 |
commit | b98576ed15d0a923012052e262236c9d26d89d89 (patch) | |
tree | ec91791ee1bae7c5c6d09ec60eacb844b73d7713 /crypto/src/openpgp/PgpPublicKey.cs | |
parent | Handle RevocationKey and RevocationReason (diff) | |
download | BouncyCastle.NET-ed25519-b98576ed15d0a923012052e262236c9d26d89d89.tar.xz |
Update IsMasterKey
Diffstat (limited to '')
-rw-r--r-- | crypto/src/openpgp/PgpPublicKey.cs | 7 |
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> |