ECKey: fix usage of deprecated method ASN1TaggedObject.getObject()
@@ -725,7 +725,8 @@ public class ECKey implements EncryptableItem {
ASN1TaggedObject pubkey = (ASN1TaggedObject) seq.getObjectAt(3);
checkArgument(pubkey.getTagNo() == 1, "Input has 'publicKey' with bad tag number");
- byte[] pubbits = ((DERBitString)pubkey.getObject()).getBytes();
+ checkArgument(pubkey.getTagClass() == BERTags.CONTEXT_SPECIFIC, "Input has 'publicKey' with bad tag class");
+ byte[] pubbits = ((DERBitString) pubkey.getBaseObject()).getBytes();
checkArgument(pubbits.length == 33 || pubbits.length == 65, "Input has 'publicKey' with invalid length");
int encoding = pubbits[0] & 0xFF;
// Only allow compressed(2,3) and uncompressed(4), not infinity(0) or hybrid(6,7)
