diff --git a/crypto/src/openpgp/PgpPublicKey.cs b/crypto/src/openpgp/PgpPublicKey.cs index 672ce9548..ed8a1c25c 100644 --- a/crypto/src/openpgp/PgpPublicKey.cs +++ b/crypto/src/openpgp/PgpPublicKey.cs @@ -1100,7 +1100,7 @@ private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id, Pgp 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])) {