// Extract the key information
ByteArrayReader bar = new ByteArrayReader(encoded);
String header = bar.readString();
if (!header.equals(getAlgorithmName())) {
throw new InvalidKeyException();
}
BigInteger e = bar.readBigInteger();
BigInteger n = bar.readBigInteger();
rsaKey = new RSAPublicKeySpec(n, e);
try {
KeyFactory kf = KeyFactory.getInstance("RSA");
pubKey = (RSAPublicKey) kf.generatePublic(rsaKey);
} catch (NoSuchAlgorithmException nsae) {
throw new InvalidKeyException();
} catch (InvalidKeySpecException ikpe) {
throw new InvalidKeyException();
}
} catch (IOException ioe) {
throw new InvalidKeyException();
}
}