code: public static PublicKey deserializePublicKey(byte[] keyData, String algorithm) {
          LOGGER.trace("deserialize public key from data using algorithm \"{}\"", algorithm);
          X509EncodedKeySpec pubSpec = new X509EncodedKeySpec(keyData);
          try {
              KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
              return keyFactory.generatePublic(pubSpec);
          } catch (GeneralSecurityException e) {
              throw new IllegalArgumentException("provided data could not be converted to a PublicKey for algorithm "
                      + algorithm, e);
          }
      }
docs: converts a byte[] that originally was created using {@link PublicKey#getEncoded()} back to the corresponding
  instance.
  
  Example: CipherUtils.deserializePublicKey(data, "RSA")