Skip to content

Commit a0aba13

Browse files
committed
Tweak EC point decoding exception message
1 parent e0dce82 commit a0aba13

4 files changed

Lines changed: 5 additions & 4 deletions

File tree

‎core/src/main/j2me/org/bouncycastle/math/ec/ECCurve.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ public ECPoint decodePoint(byte[] encoded)
446446
break;
447447
}
448448
default:
449-
throw new IllegalArgumentException("Invalid point encoding 0x" + Integer.toString(type, 16));
449+
throw new IllegalArgumentException("Invalid point encoding type: 0x" + Integer.toString(type, 16));
450450
}
451451

452452
if (type != 0x00 && p.isInfinity())

‎core/src/main/java/org/bouncycastle/crypto/parsers/ECIESPublicKeyParser.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ public AsymmetricKeyParameter readKey(InputStream stream)
4949
break;
5050

5151
default:
52-
throw new IOException("Sender's public key has invalid point encoding 0x" + Integer.toString(first, 16));
52+
throw new IOException("Sender's public key has invalid point encoding type: 0x"
53+
+ String.format("%02X", first));
5354
}
5455

5556
ECCurve curve = ecParams.getCurve();

‎core/src/main/java/org/bouncycastle/math/ec/ECCurve.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ public ECPoint decodePoint(byte[] encoded)
467467
break;
468468
}
469469
default:
470-
throw new IllegalArgumentException("Invalid point encoding 0x" + Integer.toString(type, 16));
470+
throw new IllegalArgumentException("Invalid point encoding type: 0x" + String.format("%02X", type));
471471
}
472472

473473
if (type != 0x00 && p.isInfinity())

‎core/src/main/jdk1.2/org/bouncycastle/math/ec/ECCurve.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ public ECPoint decodePoint(byte[] encoded)
459459
break;
460460
}
461461
default:
462-
throw new IllegalArgumentException("Invalid point encoding 0x" + Integer.toString(type, 16));
462+
throw new IllegalArgumentException("Invalid point encoding type: 0x" + Integer.toString(type, 16));
463463
}
464464

465465
if (type != 0x00 && p.isInfinity())

0 commit comments

Comments
 (0)