Skip to content

Instantly share code, notes, and snippets.

View hexatridecimal's full-sized avatar
🤩
Making something beautiful

Janet Jeffus hexatridecimal

🤩
Making something beautiful
View GitHub Profile
@hexatridecimal
hexatridecimal / rsa-test.rb
Created April 12, 2012 15:04 — forked from benders/rsa-test.rb
Ruby RSA using OpenSSL example
require 'openssl'
require 'base64'
require 'stringio'
plaintext = StringIO.new <<-EOF
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Also, because I said so.
EOF
target_key = OpenSSL::PKey::RSA.new(640)
# Adds information about the customer
def add_arb_customer(xml, options)
customer = options[:customer]
return unless customer
xml.tag!('customer') do
xml.tag! 'type' ,customer[:type] if customer[:type]
xml.tag! 'id' ,customer[:id] if customer[:id]
xml.tag! 'email' ,customer[:email] if customer[:email]
xml.tag! 'phoneNumber' ,customer[:phone_number] if customer[:phone_number]
xml.tag! 'faxNumber' ,customer[:fax_number] if customer[:fax_number]