Exemplo n.º 1
0
  static RSAPublicKey parseRSA(DataByteInputStream in) throws IOException {
    int exponentLength = in.readUnsignedByte();
    if (exponentLength == 0) exponentLength = in.readUnsignedShort();
    BigInteger exponent = in.readBigInteger(exponentLength);

    int modulusLength = in.available();
    BigInteger modulus = in.readBigInteger(modulusLength);

    RSAPublicKey rsa = new RSAPubKey(modulus, exponent);
    return rsa;
  }