Method: Ccrypto::X509::CertProfile#validity

Defined in:
lib/ccrypto/configs/x509_cert_profile.rb

#validity(qty, unit = :years) ⇒ Object Also known as: valid_for



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/ccrypto/configs/x509_cert_profile.rb', line 214

def validity(qty, unit = :years)
     
  raise CertProfileException, "not_before has to set before validity can be set" if is_empty?(@not_before)

  case unit
  when :days, :day
    adv = { days: qty }
  when :months, :month
    adv = { months: qty }
  when :weeks, :week
    adv = { weeks: qty }
  when :years, :year
    adv = { years: qty }
  else
    raise CertProfileException, "Unknown unit '#{unit}'"
  end

  @not_after = @not_before.advance(adv)

end