hi, i have a certificate file in pem format. i need to read the pem file. Need help on how to read the certificate in ruby on rails Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 24, 7:15 am, Sreevarshini Kuppuraj <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> hi, > i have a certificate file in pem format. i need to read the pem file. > Need help on how to read the certificate in ruby on railsThe ruby openssl library can do that - it''s basically a straight mapping of the openssl library. Fred> > Thanks > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Aug 24, 7:15�am, Sreevarshini Kuppuraj <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> hi, >> i have a certificate file in pem format. i need to read the pem file. >> Need help on how to read the certificate in ruby on rails > > The ruby openssl library can do that - it''s basically a straight > mapping of the openssl library. > > FredHi Fred, thanks for the reply. i am already using open SSL library, can you help me with any example or code snippet on how to read the pem file in ruby? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Aug 25, 5:16 am, Sreevarshini Kuppuraj <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Frederick Cheung wrote:> Hi Fred, > thanks for the reply. i am already using open SSL library, can you help > me with any example or code snippet on how to read the pem file in ruby?You should be able to do something like OpenSSL::X509::Certificate.new(File.read(path_to_certificate)) (OpenSSL::PKey::RSA.new(File.read(path_to_key)) if it''s just a key in the pem file) Fred -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung wrote:> On Aug 25, 5:16�am, Sreevarshini Kuppuraj <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> Frederick Cheung wrote: > >> Hi Fred, >> thanks for the reply. i am already using open SSL library, can you help >> me with any example or code snippet on how to read the pem file in ruby? > > You should be able to do something like > OpenSSL::X509::Certificate.new(File.read(path_to_certificate)) > (OpenSSL::PKey::RSA.new(File.read(path_to_key)) if it''s just a key in > the pem file) > > FredHi Fred, I did the same with the follwing line of code, but i am getting "certificate verify failed" error Code snippet: cert = File.read("sdk-seller_cert_key.pem") pem = File.read("sdk-seller.pem") http.use_ssl = true http.cert = OpenSSL::X509::Certificate.new(cert) http.key = OpenSSL::PKey::RSA.new(pem) http.verify_mode = OpenSSL::SSL::VERIFY_PEER Where am i going wrrong? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sreevarshini Kuppuraj wrote:> Frederick Cheung wrote: >> On Aug 25, 5:16�am, Sreevarshini Kuppuraj <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> >> wrote: >>> Frederick Cheung wrote: >> >>> Hi Fred, >>> thanks for the reply. i am already using open SSL library, can you help >>> me with any example or code snippet on how to read the pem file in ruby? >> >> You should be able to do something like >> OpenSSL::X509::Certificate.new(File.read(path_to_certificate)) >> (OpenSSL::PKey::RSA.new(File.read(path_to_key)) if it''s just a key in >> the pem file) >> >> Fred > > Hi Fred, > I did the same with the follwing line of code, but i am getting > "certificate verify failed" error > > Code snippet: > cert = File.read("sdk-seller_cert_key.pem") > pem = File.read("sdk-seller.pem") > http.use_ssl = true > http.cert = OpenSSL::X509::Certificate.new(cert) > http.key = OpenSSL::PKey::RSA.new(pem) > http.verify_mode = OpenSSL::SSL::VERIFY_PEER > > Where am i going wrrong? > > ThanksHi, any work arround for this issue? Thanks -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.