lib/r509/crl.rb in r509-0.9 vs lib/r509/crl.rb in r509-0.9.1

- old
+ new

@@ -197,11 +197,13 @@ def revoke_cert(serial,reason=nil, revoke_time=Time.now.to_i, generate_and_save=true) if not reason.to_i.between?(0,10) reason = 0 end serial = serial.to_i - reason = reason.to_i + if not reason.nil? + reason = reason.to_i + end revoke_time = revoke_time.to_i if revoked?(serial) raise R509::R509Error, "Cannot revoke a previously revoked certificate" end @revoked_certs[serial] = {:reason => reason, :revoke_time => revoke_time} @@ -220,11 +222,11 @@ generate_crl save_crl_list nil end - # Remove serial from revocation list + # Generate the CRL # # @return [String] PEM encoded signed CRL def generate_crl crl = OpenSSL::X509::CRL.new crl.version = 1 @@ -235,10 +237,10 @@ self.revoked_certs.each do |serial, reason, revoke_time| revoked = OpenSSL::X509::Revoked.new revoked.serial = OpenSSL::BN.new serial.to_s revoked.time = Time.at(revoke_time) - if !reason.nil? + if not reason.nil? enum = OpenSSL::ASN1::Enumerated(reason) #see reason codes below ext = OpenSSL::X509::Extension.new("CRLReason", enum) revoked.add_extension(ext) end #now add it to the crl