code: public static PublicKey readPublicKey(final byte[] publicKeyBytes, final String algorithm)
  		throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException
  	{
  		final X509EncodedKeySpec keySpec = new X509EncodedKeySpec(publicKeyBytes);
  		final KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
  		final PublicKey publicKey = keyFactory.generatePublic(keySpec);
  		return publicKey;
  	}
docs: Read public key.
  
  @param publicKeyBytes
  the public key bytes
  @param algorithm
  the algorithm for the {@link KeyFactory}
  @return the public key
  @throws NoSuchAlgorithmException
  is thrown if instantiation of the cypher object fails.
  @throws InvalidKeySpecException
  is thrown if generation of the SecretKey object fails.
  @throws NoSuchProviderException
  is thrown if the specified provider is not registered in the security provider
  list.