mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-11-02 05:27:17 +00:00
ECKey.decodeFromDER(): Also throws IllegalArgumentException if unexpected class was read.
Fixes a regression that was introduced with commit e5f14e789a.
This commit is contained in:
@@ -578,9 +578,12 @@ public class ECKey implements EncryptableItem {
|
||||
ASN1InputStream decoder = null;
|
||||
try {
|
||||
decoder = new ASN1InputStream(bytes);
|
||||
DLSequence seq = (DLSequence) decoder.readObject();
|
||||
if (seq == null)
|
||||
final ASN1Primitive seqObj = decoder.readObject();
|
||||
if (seqObj == null)
|
||||
throw new IllegalArgumentException("Reached past end of ASN.1 stream.");
|
||||
if (!(seqObj instanceof DLSequence))
|
||||
throw new IllegalArgumentException("Read unexpected class: " + seqObj.getClass().getName());
|
||||
final DLSequence seq = (DLSequence) seqObj;
|
||||
ASN1Integer r, s;
|
||||
try {
|
||||
r = (ASN1Integer) seq.getObjectAt(0);
|
||||
|
||||
Reference in New Issue
Block a user