repo.or.cz
/
ruby-svn.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
history
|
raw
|
HEAD
* io.c (rb_open_file): encoding in mode string was ignored if perm is
[ruby-svn.git]
/
sample
/
openssl
/
cert2text.rb
blob
50da224e7673a540ac77c6c0738329c1d725fa41
1
#!/usr/bin/env ruby
2
3
require 'openssl'
4
include OpenSSL::X509
5
6
def cert2text(cert_str)
7
[Certificate, CRL, Request].each do |klass|
8
begin
9
puts klass.new(cert_str).to_text
10
return
11
rescue
12
end
13
end
14
raise ArgumentError.new('Unknown format.')
15
end
16
17
if ARGV.empty?
18
cert2text(STDIN.read)
19
else
20
ARGV.each do |file|
21
cert2text(File.read(file))
22
end
23
end