blob: 0193247a4a6778a68741cd8b0318f8de1c79f624 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/env ruby
require 'openssl'
include OpenSSL
include PKey
include Cipher
#p RSA.new(1024)
p priv = RSA.new(File.read("./0key.pem")) {
print "Enter password: "
gets.chop!
}
p priv.private?
p pub = RSA.new(File.read("./0pub.pem"))
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
|