我有一个供应商与我分享的公钥 . 我有一个看起来像这样的模型方法;

def self.decode_signature(signature)      
      public_key = OpenSSL::PKey::RSA.new(File.read(Rails.root.join("public/certificate.pem")))
      string = public_key.private_decrypt(Base64.decode64(signature))
      return string
  end

但是,当我运行它时,它返回错误 OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: nested asn1 error

我尝试了几件白白的东西,包括.crt,.der .

环境:Rails 3.1.2和Ruby 1.9.3

欢迎提供帮助!