checkIsBigInteger(val, "Wrong exponent1 field");
DerUtil.checkIsBigInteger(val, "Wrong exponent1 field");
  public PrivateKey decodePrivateKey(byte[] input)  {    if (input == null)      throw new InvalidParameterException("Input bytes MUST NOT be null");    BigInteger version, n, e, d, p, q, dP, dQ, qInv;    DERReader der = new DERReader(input);    try      {        DERValue derPKI = der.read();        checkIsConstructed(derPKI, "Wrong PrivateKeyInfo field");        DERValue derVersion = der.read();        checkIsBigInteger(derVersion, "Wrong Version field");        version = (BigInteger) derVersion.getValue();        if (version.compareTo(BigInteger.ZERO) != 0)          throw new InvalidParameterException("Unexpected Version: " + version);        DERValue derAlgoritmID = der.read();        checkIsConstructed(derAlgoritmID, "Wrong AlgorithmIdentifier field");        DERValue derOID = der.read();        OID algOID = (OID) derOID.getValue();        if (! algOID.equals(RSA_ALG_OID))          throw new InvalidParameterException("Unexpected OID: " + algOID);        DERValue val = der.read();        byte[] pkBytes = (byte[]) val.getValue();        der = new DERReader(pkBytes);        DERValue derRSAPrivateKey = der.read();        checkIsConstructed(derRSAPrivateKey, "Wrong RSAPrivateKey field");                val = der.read();        checkIsBigInteger(val, "Wrong RSAPrivateKey Version field");        version = (BigInteger) val.getValue();        if (version.compareTo(BigInteger.ZERO) != 0)          throw new InvalidParameterException("Unexpected RSAPrivateKey Version: "                                              + version);        val = der.read();        checkIsBigInteger(val, "Wrong modulus field");        n = (BigInteger) val.getValue();        val = der.read();        checkIsBigInteger(val, "Wrong publicExponent field");        e = (BigInteger) val.getValue();        val = der.read();        checkIsBigInteger(val, "Wrong privateExponent field");        d = (BigInteger) val.getValue();        val = der.read();        checkIsBigInteger(val, "Wrong prime1 field");        p = (BigInteger) val.getValue();        val = der.read();        checkIsBigInteger(val, "Wrong prime2 field");        q = (BigInteger) val.getValue();        val = der.read();        checkIsBigInteger(val, "Wrong exponent1 field");        dP = (BigInteger) val.getValue();        val = der.read();        checkIsBigInteger(val, "Wrong exponent2 field");        dQ = (BigInteger) val.getValue();        val = der.read();        checkIsBigInteger(val, "Wrong coefficient field");        qInv = (BigInteger) val.getValue();      }    catch (IOException x)      {        InvalidParameterException y = new InvalidParameterException();        y.initCause(x);        throw y;      }    return new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q,                                dP, dQ, qInv);  }