title: Generate digital signature of a file
body: <p>I'm currently trying to make an application which could digitally sign any kind of document. I have declared the class GenSig according to <a href="http://docs.oracle.com/javase/tutorial/security/apisign/step1.html" rel="nofollow">this tutorial</a>. However in my application there should be GUI for a file input. So I have; </p>
  
  <pre><code>File file = jFileChooser2.getSelectedFile();
  
  FileInputStream fin = new FileInputStream(file);
  byte fileContent[] = new byte[(int)file.length()];
  fin.read(fileContent);            
  
  String strFileContent = new String(fileContent);           
  
  GenSig gensig = new GenSig();        
  GenSig.main(strFileContent); 
  </code></pre>
  
  <p>It's throwing me an error on line <code>GenSig.main(strFileContent);</code> Where the variable should be <code>String[] args</code> according to whole <a href="http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/security/apisign/examples/GenSig.java" rel="nofollow">source of GenSig class</a> so I can't compile the application. I assume that the problem is in the type of string, it's not array, but I don't know which array, which variable from File object, I've declared on firts line, I need to use as input. </p>
  
  <p>I know I'm doing something wrong, unfortunately in Java I'm just beginner so I need help a bit.</p>
  
  <ul>
  <li><p><strong>What variable from file object should I insert as input for GenSig class?</strong></p></li>
  <li><p><strong>Is there any easier way how to sign documents in Java?</strong></p></li>
  </ul>