aboutsummaryrefslogtreecommitdiffstats
path: root/test/ossl_rsa.rb
blob: 1ab9cd1fc6bfec0e88e5952966fd9f7136c8c99b (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_str == priv2.to_str
#puts priv.to_pem
#puts pub.to_str
#puts priv.to_str
#puts pub.export