title: Convert signature into human readable (bouncycastle)
body: <p>I want to sign a file I read in with <code>JFileChooser</code>. But when I print it to the terminal I can only read questonmarks and other not human readable characters. 
  My code to sign is:</p>
  
  <pre><code>public static void sign() throws Exception{
      byte[] file = fileChooser();
  
      store = KeyStore.getInstance(storeType);
      FileInputStream in = new FileInputStream(new File(storePath));
      store.load(in, storePassword);
      in.close();
  
      Key priv = store.getKey("test", storePassword);
      System.out.println(priv.toString() + "priv string");
      X509Certificate cert = (X509Certificate) store.getCertificate("Subject");
      ContentSigner signer = new JcaContentSignerBuilder("SHA512withRSA").build((RSAPrivateKey) priv);        
  
      //Sign Data
      Signature signature = Signature.getInstance("SHA512WithRSA");
      signature.initSign((RSAPrivateKey) priv);
      signature.update(file);
  
      //Build cms
      CMSTypedData data = new CMSProcessableByteArray(signature.sign()); 
      CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
  
      gen.addSignerInfoGenerator(
              new JcaSignerInfoGeneratorBuilder(
                      new JcaDigestCalculatorProviderBuilder().build())
                      .build(signer, cert));
  
      //Get signed data
      CMSSignedData sigData = gen.generate(data, false);
  
      byte[] sig = (byte[]) sigData.getSignedContent().getContent();
      sig.toString();
      String content = new String(sig);
      System.out.println("Signed content: " + content + "\n");
  }
  </code></pre>
  
  <p>How can I format the signature to human readable?</p>