Q:

How to convert public key and signature value in human readable format

I am trying to generate public key and signature in readable format which can be used in rest service .i have write following code .
public static void  GenearetSignature(String url,String signatureValue,String publicKey){
    KeyPairGenerator keyGen;
    try {
        keyGen = KeyPairGenerator.getInstance("DSA", "SUN");

        SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN");
        keyGen.initialize(1024, random);
        KeyPair pair = keyGen.generateKeyPair();
        PrivateKey priv = pair.getPrivate();
        PublicKey pub = pair.getPublic();
        System.out.println("Priavte key"+priv);
        System.out.println("Public  key");
        Signature dsa = Signature.getInstance("SHA1withDSA", "SUN"); 
        dsa.initSign(priv);
        dsa.update(url.getBytes());
        byte[]  signatureValueArray = dsa.sign();
        signatureValue=new String(signatureValueArray,"UTF8");
        byte[] publicKeyArray=pub.getEncoded();
        publicKey = new String(publicKeyArray);
        System.out.println("publicKey is "+publicKey);
        System.out.println("signatureValue is "+signatureValue);
    } catch (NoSuchAlgorithmException  ex) {
        // TODO Auto-generated catch block
        ex.printStackTrace();
    } catch(Exception e){
        e.printStackTrace();
    }
}

But this is not generating in alphanumeric value .how can i achieve that .please help me

A:

If you want hexadecimal represenation of byte array use 
javax.xml.bind.DatatypeConverter.printHexBinary(byte[] array)

