if (!(key instanceof GnuRSAPrivateKey)) {
if (! (key instanceof GnuRSAPrivateKey))
  public byte[] encodePrivateKey(PrivateKey key)  {    if (!(key instanceof GnuRSAPrivateKey))      {        throw new IllegalArgumentException("key");      }    GnuRSAPrivateKey rsaKey = (GnuRSAPrivateKey) key;    ByteArrayOutputStream baos = new ByteArrayOutputStream();    // magic    baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[0]);    baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[1]);    baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[2]);    baos.write(Registry.MAGIC_RAW_RSA_PRIVATE_KEY[3]);    // version    baos.write(0x01);    // p    byte[] buffer = rsaKey.getPrimeP().toByteArray();    int length = buffer.length;    baos.write(length >>> 24);    baos.write((length >>> 16) & 0xFF);    baos.write((length >>> 8) & 0xFF);    baos.write(length & 0xFF);    baos.write(buffer, 0, length);    // q    buffer = rsaKey.getPrimeQ().toByteArray();    length = buffer.length;    baos.write(length >>> 24);    baos.write((length >>> 16) & 0xFF);    baos.write((length >>> 8) & 0xFF);    baos.write(length & 0xFF);    baos.write(buffer, 0, length);    // e    buffer = rsaKey.getPublicExponent().toByteArray();    length = buffer.length;    baos.write(length >>> 24);    baos.write((length >>> 16) & 0xFF);    baos.write((length >>> 8) & 0xFF);    baos.write(length & 0xFF);    baos.write(buffer, 0, length);    // d    buffer = rsaKey.getPrivateExponent().toByteArray();    length = buffer.length;    baos.write(length >>> 24);    baos.write((length >>> 16) & 0xFF);    baos.write((length >>> 8) & 0xFF);    baos.write(length & 0xFF);    baos.write(buffer, 0, length);    return baos.toByteArray();  }