Digitally signing with the public key
<p>As I understand, a digital signature is obtained by encrypting (the message digest) with your own private key and then the recipient's public key.</p>

<p>In Java, I can't figure out how to use a public key to perform the second stage of signing.</p>

<pre><code>Signature sig = Signature.getInstance("MD5WithRSA");
sig.initSign(privateKey);
sig.update(data);
byte[] signatureBytes = sig.sign();
</code></pre>

<p>I checked the API, the only methods that use a public key are for verifying...</p>
