<p><pre><code>    function encrypt(public_key, file) {
     var pem_pub_key = sshKeyToPEM(public_key); &#x2F;&#x2F; convert rsa to pem
    
     var chunks = [];
     var buffer = new Buffer(fs.readFileSync(file, &#x27;utf8&#x27;));
    
     &#x2F;&#x2F; work around for 214 character limit for encrypting
     &#x2F;&#x2F; text with small openssh rsa pub key
     for (var i = 0; i &lt;= (buffer.length &#x2F; 214); i++) {
      chunks.push(buffer.slice(i * 214, (i * 214) + 214));
     }
    
     chunks.forEach(function(chunk) {
       var encrypted = crypto.publicEncrypt(pem_pub_key, new Buffer(chunk));
       console.log(encrypted.toString(&#x27;base64&#x27;));
     });
    }
</code></pre>
According to the docs, crypto.publicEncrypt uses OAEP by default, so the bulk of the terribleness should mainly be how horribly slow this is. It does clearly indicate that the author has no idea what they&#x27;re doing, though.<p>Edit: For some reason I thought OAEP included randomness. It does not, which should mean you can guess-and-check the plaintext.