Class: R509::CertificateAuthority::HTTP::ValidityPeriodConverter

Inherits:
Object
  • Object
show all
Defined in:
lib/r509/certificateauthority/http/validityperiodconverter.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) convert(validity_period)



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/r509/certificateauthority/http/validityperiodconverter.rb', line 3

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
  {
    :not_before => Time.now - 6 * 60 * 60,
    :not_after => Time.now + validity_period.to_i,
  }
end