title: Java - Encrypt String with existing public key file
body: <p>I've been researching this for the past 4-5 hours now and can't seem to find an answer that actually <em>works</em> despite finding 'answers' that used everything from a few methods to an entire ~100 line class. I can't imagine that there isn't some simple function to do such a trivial thing :P</p>
  
  <p>I have a pre-existing set of public / private keys (actually, two sets - one generated by ssh-keygen and another by openssl so .. whatever format works is cool). </p>
  
  <p>All I am after is a simple java equivalent to what I write in python like -</p>
  
  <pre><code>key_object = someModule.KeyObject(nameOfPublicKeyFile)
  
  def encrypt (SomePlainText) :
    return someOtherModule.encrypt(key_object, SomePlainText)
  </code></pre>
  
  <p>Any help would be awesome!</p>