}
  public byte[] encodePublicKey(PublicKey key)  {    if (!(key instanceof GnuRSAPublicKey))      {        throw new IllegalArgumentException("key");      }    GnuRSAPublicKey rsaKey = (GnuRSAPublicKey) key;    ByteArrayOutputStream baos = new ByteArrayOutputStream();    // magic    baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[0]);    baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[1]);    baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[2]);    baos.write(Registry.MAGIC_RAW_RSA_PUBLIC_KEY[3]);    // version    baos.write(0x01);    // n    byte[] buffer = rsaKey.getModulus().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);    // 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);    return baos.toByteArray();  }