title: how to do verify using java.security.Signature
body: <p>I have a key pair already, public and private. How do I actually use the <code>java.security.Signature</code> to do verification of a string I signed with one of the keys? </p>
  
  <p>Edit: </p>
  
  <p>I have both the keys as Strings. The verify method, it is actually</p>
  
  <pre><code>verify(byte[] signature)
  </code></pre>
  
  <p>The javadoc says:</p>
  
  <blockquote>
    <p><code>verify(byte[] signature)</code> Indicates whether the given signature can be
    verified using the public key or a certificate of the signer.</p>
  </blockquote>
  
  <p>How would I make that signature recognize which public/private key to use for that verifying, before I call the verify method? In other words, how do I turn my string keys into key objects that would get accepted by signature?</p>