Skip to content

Commit 2c69b9b

Browse files
committed
PGPPublicKey: getUserIds() -> skip non-UTF8 uids
Those are still accessible via getRawUserIds()
1 parent f129a33 commit 2c69b9b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pg/src/main/java/org/bouncycastle/openpgp/PGPPublicKey.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,14 @@ public Iterator<String> getUserIDs()
487487
{
488488
if (ids.get(i) instanceof UserIDPacket)
489489
{
490-
temp.add(((UserIDPacket)ids.get(i)).getID());
490+
try
491+
{
492+
temp.add(((UserIDPacket) ids.get(i)).getID());
493+
}
494+
catch (IllegalArgumentException e)
495+
{
496+
// Skip non-UTF8 user-ids
497+
}
491498
}
492499
}
493500

0 commit comments

Comments
 (0)