aboutsummaryrefslogtreecommitdiffstats
path: root/test/ossl_rsa.rb
blob: 266cecef560171823fbbd4e6872bedb2704694e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env ruby

require 'openssl'
include OpenSSL
include PKey
include Cipher
#p RSA.new(1024)
p priv = RSA.new(File.open("./01key.pem").read, "pejs8nek")
p priv.private?
p pub = RSA.new(File.open("./01pub.pem").read)
p pub.private?
puts exp = priv.export(DES.new(EDE3, CBC), "password")
p priv2 = RSA.new(exp, "password")
p priv.to_text == priv2.to_text
#puts priv.to_pem
#puts pub.to_text
#puts priv.to_text
#puts pub.export