4

I have a public key shared with me by one of the vendors. I have a model method that looks like this;

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

However when i run it, it returns the error OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: nested asn1 error

I have tried a couple of things in vain including .crt, .der.

Environment: Rails 3.1.2 and Ruby 1.9.3

Assistance is welcome!

acacia
  • 1,375
  • 1
  • 14
  • 40
  • 1
    Same questions as http://stackoverflow.com/questions/14391312/openssl-neither-pub-key-nor-priv-key-nested-asn1-error – dentarg Jun 25 '15 at 23:23

0 Answers0