3 while line = $stdin.gets
5 next if line =~ /^\s*$/
8 label,type,val = line.split(' ',3)
11 fname = val.gsub(/\//,"_").gsub(/\s+/, "_").gsub(/[()]/, "=").gsub(/,/, "_") + ".crt"
14 if line =~ /CKA_VALUE MULTILINE_OCTAL/
16 while line = $stdin.gets
19 line.gsub(/\\([0-3][0-7][0-7])/) { data += $1.oct.chr }
21 open(fname, "w") do |fp|
22 fp.puts "-----BEGIN CERTIFICATE-----"
23 fp.puts [data].pack("m*")
24 fp.puts "-----END CERTIFICATE-----"
26 puts "Created #{fname}"
29 # system("c_rehash", ".")