Sha256: 93c5dd28234f67be441f0e552fd4129152cb5e673b3c41b0912610aa14c5afc9

Contents?: true

Size: 627 Bytes

Versions: 1

Compression:

Stored size: 627 Bytes

Contents

module R509::CertificateAuthority::HTTP
  class ValidityPeriodConverter
    def convert(validity_period)
      if validity_period.nil?
        raise ArgumentError, "Must provide validity period"
      end
      if validity_period.to_i <= 0
        raise ArgumentError, "Validity period must be positive"
      end
      {
        # Begin the validity period 6 hours into the past, to account for
        # possibly-slow clocks.
        :not_before => Time.now - (6 * 60 * 60),
        # Add validity_period number of seconds to the current time.
        :not_after => Time.now + validity_period.to_i,
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
r509-ca-http-0.3.2 lib/r509/certificateauthority/http/validityperiodconverter.rb