public static PublicKey createPublicKeyFromBytes(byte[] keyBytes){
  PublicKey pk=null;
  try {
    KeyFactory keyFactory=KeyFactory.getInstance(KeyConstants.KEY_FACTORY,new BouncyCastleProvider());
    pk=keyFactory.generatePublic(new X509EncodedKeySpec(keyBytes));
  }
 catch (  NoSuchAlgorithmException|InvalidKeySpecException e) {
    logger.warn("Exception caught in CryptCore." + "createPublicKeyFromBytes, returning null",e);
  }
  return pk;
}

public static PublicKey createPublicKeyFromBytes ( byte [ ] keyBytes ) { PublicKey pk = null ; try { KeyFactory keyFactory = KeyFactory . getInstance ( KeyConstants . KEY_FACTORY , new BouncyCastleProvider ( ) ) ; pk = keyFactory . generatePublic ( new X509EncodedKeySpec ( keyBytes ) ) ; } catch ( NoSuchAlgorithmException | InvalidKeySpecException e ) { logger . warn ( "Exception caught in CryptCore." + "createPublicKeyFromBytes, returning null" , e ) ; } return pk ; }
creates a public key from a byte [ ]
