def _get_asn1_time(timestamp):
 string_timestamp = _ffi.cast('ASN1_STRING*', timestamp)
 if (_lib.ASN1_STRING_length(string_timestamp) == 0):
  return None
 elif (_lib.ASN1_STRING_type(string_timestamp) == _lib.V_ASN1_GENERALIZEDTIME):
  return _ffi.string(_lib.ASN1_STRING_data(string_timestamp))
 else:
  generalized_timestamp = _ffi.new('ASN1_GENERALIZEDTIME**')
  _lib.ASN1_TIME_to_generalizedtime(timestamp, generalized_timestamp)
  if (generalized_timestamp[0] == _ffi.NULL):
   _untested_error('ASN1_TIME_to_generalizedtime')
  else:
   string_timestamp = _ffi.cast('ASN1_STRING*', generalized_timestamp[0])
   string_data = _lib.ASN1_STRING_data(string_timestamp)
   string_result = _ffi.string(string_data)
   _lib.ASN1_GENERALIZEDTIME_free(generalized_timestamp[0])
   return string_result

def _get_asn1_time ( timestamp ) : string_timestamp = _ffi . cast ( 'ASN1_STRING*' , timestamp ) if ( _lib . ASN1_STRING_length ( string_timestamp ) == 0 ) : return None elif ( _lib . ASN1_STRING_type ( string_timestamp ) == _lib . V_ASN1_GENERALIZEDTIME ) : return _ffi . string ( _lib . ASN1_STRING_data ( string_timestamp ) ) else : generalized_timestamp = _ffi . new ( 'ASN1_GENERALIZEDTIME**' ) _lib . ASN1_TIME_to_generalizedtime ( timestamp , generalized_timestamp ) if ( generalized_timestamp [ 0 ] == _ffi . NULL ) : _untested_error ( 'ASN1_TIME_to_generalizedtime' ) else : string_timestamp = _ffi . cast ( 'ASN1_STRING*' , generalized_timestamp [ 0 ] ) string_data = _lib . ASN1_STRING_data ( string_timestamp ) string_result = _ffi . string ( string_data ) _lib . ASN1_GENERALIZEDTIME_free ( generalized_timestamp [ 0 ] ) return string_result
retrieve the time value of an asn1 time object .