So I have this key information that I got by generating a private and public key in VB, but it gave it to me in the form of a modulus and exponent in an XML file. Now, I need to encrypt some stuff in ruby using that info. On this site: http://blog.internautdesign.com/2007/11/2/ruby-openssl-rsa-public-key-from-modulus-and-exponent/comments/165, they explain how to do that, but clearly this info is in integer format so I need to convert my stuff, which looks similar to: tzG8K55r0VFT0uwhQa+PEoavFOH7TF9X5TWfyYc1a6JfY91KWpaj0 into a smiliar format. Right now I am decoding it from Base64 which I assumes leave me with a Hex value, but I am unsure about how to proceed. Anyone have any ideas? Thanks, -S -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Shandy Nantz wrote:> So I have this key information that I got by generating a private and > public key in VB, but it gave it to me in the form of a modulus and > exponent in an XML file. Now, I need to encrypt some stuff in ruby using > that info. On this site: > http://blog.internautdesign.com/2007/11/2/ruby-openssl-rsa-public-key-from-modulus-and-exponent/comments/165, > they explain how to do that, but clearly this info is in integer format > so I need to convert my stuff, which looks similar to: > tzG8K55r0VFT0uwhQa+PEoavFOH7TF9X5TWfyYc1a6JfY91KWpaj0 into a smiliar > format. Right now I am decoding it from Base64 which I assumes leave me > with a Hex value, but I am unsure about how to proceed. Anyone have any > ideas? Thanks,If you are doing asymmetric encryption in Rails, I recommend the Sentry gem. It makes encrypting model attributes trivially easy. It also includes some documentation for how to work with keys, though I don''t recall anything on modulus/exponent format. Most encryption I''ve seen uses OpenSSL to generate a public/private key pair. If you aren''t required to use your VB-generated pair, you might want to think about going the standard way and generating a new pair using OpenSSL. -- Josh Susser http://blog.hasmanythrough.com -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Josh Susser wrote:> If you are doing asymmetric encryption in Rails, I recommend the Sentry > gem. It makes encrypting model attributes trivially easy. It also > includes some documentation for how to work with keys, though I don''t > recall anything on modulus/exponent format. Most encryption I''ve seen > uses OpenSSL to generate a public/private key pair. If you aren''t > required to use your VB-generated pair, you might want to think about > going the standard way and generating a new pair using OpenSSL. > > -- > Josh Susser > http://blog.hasmanythrough.comIt''s really not an issue using the VB or Ruby generated keys, because I can get both to generate keys, the problem is that I need to be able to port the keys to be used by the other. For exmaple, if I generate my key in Ruby I need to get it into a format that VB can use it, but it seems that between the two languages it is apples and oranges. Right now I can get VB to generate an xml file holding the "parts" that make up a key, the problem happens when I try and get those parts into the correct format so ruby can use the key. So if I have this: private_key = OpenSSL::PKey::RSA.new(1024) I can set the modulus and exponent for the keys like this: private_key.n = ..... private_key.e = ..... The problms is that the keys from VB is just a lot of characters, for example: PEoavFOH7TF9X5TWfyYc1aJfY91Wpaj0osU2t3gQk9cSpDWDhNHXjXa7oSAWScQNMmR8 and I need to make it look like this: 42112068797415937200008076003921911646192548127635288 Thanks, -S -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Maybe Matching Threads
- [Bug 2560] New: sshd: Description of hashed known_hosts file does not make sense and format is outdated
- Encoding SSH RSA public key
- Authenticating the rsync server
- Is there a documentation of the key file formats?
- [LLVMdev] LLD: representation of a power of two value