def dummy_time(start=datetime.datetime.now(datetime.timezone.utc)): t = Times() t.authtime = dt_to_kerbtime(start) t.starttime = dt_to_kerbtime(start) t.endtime = dt_to_kerbtime(start + datetime.timedelta(days=1)) t.renew_till = dt_to_kerbtime(start + datetime.timedelta(days=2)) return t
def from_asn1(enc_as_rep_part): t = Times() if 'authtime' in enc_as_rep_part and enc_as_rep_part['authtime']: t.authtime = dt_to_kerbtime(enc_as_rep_part['authtime']) else: t.authtime = 0 if 'starttime' in enc_as_rep_part and enc_as_rep_part['starttime']: t.starttime = dt_to_kerbtime(enc_as_rep_part['starttime']) else: t.starttime = 0 t.endtime = dt_to_kerbtime(enc_as_rep_part['endtime']) t.renew_till = dt_to_kerbtime(enc_as_rep_part['renew-till']) return t