title: open3 popen3 binary data
body: <p>I'm trying to send binary data through popen3, however I am getting an error.</p>
  
  <p>The shell command I'm issuing is:</p>
  
  <pre><code>key = File.open('path.key').read
  Open3.popen3("openssl pkcs8 -inform DER -outform PEM -passin pass:#{password}") do |stdin,  stdout, stderr|
    stdin.print(key)
    unless (err = stderr.read).empty? then raise err end
    stdout.read
  end
  </code></pre>
  
  <p>where key is a binary file. OpenSSL says the key isn't valid, and I'm scratching my head.</p>
  
  <p>Now, if I issue the command by having OpenSSL read it directly from the file system instead of passing it through the standard input it works correctly</p>
  
  <pre><code>"openssl pkcs8 -in path.key -inform DER -outform PEM -passin pass:#{password}"
  </code></pre>
  
  <p>Is there an encoding issue I'm not aware of? Or is this simply impossible. Since I will be receiving the keyfiles through a webservice, I would rather not have to save them to disk and have openssl read them, and instead do the whole process in memory.</p>
  
  <p>Thank you for your time</p>