diff --git a/crypto/src/openpgp/PgpPublicKey.cs b/crypto/src/openpgp/PgpPublicKey.cs index 672ce9548..13d87021f 100644 --- a/crypto/src/openpgp/PgpPublicKey.cs +++ b/crypto/src/openpgp/PgpPublicKey.cs @@ -1050,7 +1050,7 @@ private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id) PgpPublicKey returnKey = new PgpPublicKey(key); bool found = false; - for (int i = 0; i < returnKey.ids.Count; i++) + for (int i = returnKey.ids.Count-1; i >=0; i--) { if (id.Equals(returnKey.ids[i])) {