3 while line = $stdin.gets
10 if line =~ /CKA_LABEL/
11 label,type,val = line.split(' ',3)
14 fname = val.gsub(/\//,"_").gsub(/\s+/, "_").gsub(/[()]/, "=").gsub(/,/, "_") + ".crt"
17 if line =~ /CKA_VALUE MULTILINE_OCTAL/
19 puts "E: unexpected CKA_VALUE MULTILINE_OCTAL"
23 while line = $stdin.gets
24 break if line =~ /^END/
26 line.gsub(/\\([0-3][0-7][0-7])/) { data += $1.oct.chr }
28 open(fname, "w") do |fp|
29 fp.puts "-----BEGIN CERTIFICATE-----"
30 fp.puts [data].pack("m*")
31 fp.puts "-----END CERTIFICATE-----"
33 puts "Created #{fname}"
36 # system("c_rehash", ".")