if (Configuration.DEBUG)
  public byte[] encodePrivateKey(PrivateKey key)  {    log.entering(this.getClass().getName(), "encodePrivateKey()", key);    if (! (key instanceof GnuRSAPrivateKey))      throw new InvalidParameterException("Wrong key type");    GnuRSAPrivateKey pk = (GnuRSAPrivateKey) key;    BigInteger n = pk.getN();    BigInteger e = pk.getE();    BigInteger d = pk.getPrivateExponent();    BigInteger p = pk.getPrimeP();    BigInteger q = pk.getPrimeQ();    BigInteger dP = pk.getPrimeExponentP();    BigInteger dQ = pk.getPrimeExponentQ();    BigInteger qInv = pk.getCrtCoefficient();    DERValue derVersion = new DERValue(DER.INTEGER, BigInteger.ZERO);    DERValue derOID = new DERValue(DER.OBJECT_IDENTIFIER, RSA_ALG_OID);    ArrayList algorithmID = new ArrayList(1);    algorithmID.add(derOID);    DERValue derAlgorithmID = new DERValue(DER.CONSTRUCTED | DER.SEQUENCE,                                           algorithmID);    DERValue derRSAVersion = new DERValue(DER.INTEGER, BigInteger.ZERO);    DERValue derN = new DERValue(DER.INTEGER, n);    DERValue derE = new DERValue(DER.INTEGER, e);    DERValue derD = new DERValue(DER.INTEGER, d);    DERValue derP = new DERValue(DER.INTEGER, p);    DERValue derQ = new DERValue(DER.INTEGER, q);    DERValue derDP = new DERValue(DER.INTEGER, dP);    DERValue derDQ = new DERValue(DER.INTEGER, dQ);    DERValue derQInv = new DERValue(DER.INTEGER, qInv);    ArrayList rsaPrivateKey = new ArrayList();    rsaPrivateKey.add(derRSAVersion);    rsaPrivateKey.add(derN);    rsaPrivateKey.add(derE);    rsaPrivateKey.add(derD);    rsaPrivateKey.add(derP);    rsaPrivateKey.add(derQ);    rsaPrivateKey.add(derDP);    rsaPrivateKey.add(derDQ);    rsaPrivateKey.add(derQInv);    DERValue derRSAPrivateKey = new DERValue(DER.CONSTRUCTED | DER.SEQUENCE,                                             rsaPrivateKey);    byte[] pkBytes = derRSAPrivateKey.getEncoded();    DERValue derPrivateKey = new DERValue(DER.OCTET_STRING, pkBytes);    ArrayList pki = new ArrayList(3);    pki.add(derVersion);    pki.add(derAlgorithmID);    pki.add(derPrivateKey);    DERValue derPKI = new DERValue(DER.CONSTRUCTED | DER.SEQUENCE, pki);    byte[] result;    ByteArrayOutputStream baos = new ByteArrayOutputStream();    try      {        DERWriter.write(baos, derPKI);        result = baos.toByteArray();      }    catch (IOException x)      {        InvalidParameterException y = new InvalidParameterException();        y.initCause(x);        throw y;      }    log.exiting(this.getClass().getName(), "encodePrivateKey()", result);    return result;  }