The code is as follows:
' private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id)
{
PgpPublicKey returnKey = new PgpPublicKey(key);
bool found = false;
for (int i = 0; i <returnKey.ids.Count-1; i++)
{
if (id.Equals(returnKey.ids[i]))
{
found = true;
returnKey.ids.RemoveAt(i);
returnKey.idTrusts.RemoveAt(i);
returnKey.idSigs.RemoveAt(i);
}
}
return found ? returnKey : null;
}'
If returnKey.ids has more than one item, the first deletion will change the indexes of returnKey.*. The follow-up deletions will delete wrong items.
My pull request is as follows:
#545
The code is as follows:
' private static PgpPublicKey RemoveCert(PgpPublicKey key, IUserDataPacket id)
{
PgpPublicKey returnKey = new PgpPublicKey(key);
bool found = false;
}'
If returnKey.ids has more than one item, the first deletion will change the indexes of returnKey.*. The follow-up deletions will delete wrong items.
My pull request is as follows:
#545