mercredi 25 mars 2015

OpenSSL::PKey::RSAError: Neither PUB key nor PRIV key:: nested asn1 error

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!


Aucun commentaire:

Enregistrer un commentaire