title: `public_decrypt': padding check failed (OpenSSL::PKey::RSAError)
body: <p>Im trying to decrypt using a public key.</p>
  
  <pre><code>bob = TCPSocket.open(host, port)
  
  cs_public_key = OpenSSL::PKey::RSA.new File.read 'c_public_key.pem'
  
  puts "Alice is connected to bob"
  
  bobs_public_key = ""
  while line = bob.gets # Read lines from socket
    bobs_public_key = bobs_public_key + line   # and build them
  end
  
  bobs_public_key = JSON.parse(bobs_public_key)
  
  puts "Alice recieved Bob's Public Key:"
  puts bobs_public_key["key"]
  
  #Error is on this line.
  decypted = cs_public_key.public_decrypt(Base64.decode64(bobs_public_key["digest"])) 
  
  puts decypted
  </code></pre>
  
  <p>and am getting the error: <code>'public_decrypt': padding check failed (OpenSSL::PKey::RSAError)</code></p>
  
  <p>Can someone explain what this error means and how to avoid it?</p>