scclib
Stable Cloud Computing C++ Library
Public Member Functions | Protected Attributes | List of all members
scc::crypto::DerTimeBase Class Referenceabstract

Time base class. More...

#include <der.h>

Inheritance diagram for scc::crypto::DerTimeBase:
Inheritance graph
[legend]
Collaboration diagram for scc::crypto::DerTimeBase:
Collaboration graph
[legend]

Public Member Functions

 DerTimeBase (uint8_t tag)
 
time_t epoch () const
 Epoch time (seconds since Jan 1, 1970), in the local time zone.
 
void epoch (time_t v)
 Set epoch time.
 
void set_time (int year, int month, int day, int hour, int minute, int second)
 Set time in the local time zone.
 
void set_time (int year, int month, int day, int hour, int minute, int second, int tzmins)
 Set time in UTC time zone with tzmins offset.
 
virtual std::string name () const =0
 
virtual std::string data_str () const
 Print vizualized data.
 
- Public Member Functions inherited from scc::crypto::DerBase
 DerBase (uint8_t tag=0)
 Construct a base object. More...
 
size_t eloff () const
 Offset of the element into the binary vector.
 
void eloff (size_t v)
 
size_t elsz () const
 Binary vector element length, not including the header.
 
void elsz (size_t v)
 
size_t hdrsz () const
 Header size of the element (tag, id, and length bytes).
 
void hdrsz (size_t v)
 
size_t pre_len () const
 The length of prefix bytes (tag/id, and length).
 
virtual size_t len () const
 Length of the data.
 
virtual void parse (const std::vector< uint8_t > &v)
 Parse raw data into the object.
 
virtual void dump_pre (std::vector< char > &) const
 Dump prefix data. More...
 
virtual void dump_data (std::vector< char > &) const
 Dump data. More...
 
virtual std::string str (uint32_t=100) const
 Print summary line to maximum width.
 
std::vector< uint8_t > & data ()
 Underlying data.
 
void get_base (std::vector< uint8_t > &v) const
 Get raw data.
 
void set_base (const std::vector< uint8_t > &v)
 Set raw data.
 
void set_base (const std::vector< char > &v)
 
uint32_t id () const
 Tag id of the type. More...
 
void id (uint32_t v)
 
std::string id_str () const
 String version of the id.
 
uint8_t type_class () const
 Classification of the type (bits 7-8)
 
void type_class (uint8_t f)
 Set type class.
 
bool uni_class () const
 Universal class.
 
bool app_class () const
 Application class.
 
bool context_class () const
 Context class.
 
bool priv_class () const
 Private class.
 
std::string class_str () const
 String version of the classification.
 
bool constructed () const
 Constructed flag (bit 6).
 
void constructed (bool cons)
 Set constructed flag.
 
std::string construct_str () const
 String version of the construct flag.
 
bool is_seq () const
 Is this a sequence type?
 
bool is_set () const
 Is this a set type?
 
bool is_contain () const
 Is this a container type?
 
std::vector< BasePtr > & contain ()
 Return container, or throw an error if this is not a container.
 
bool is_integer () const
 Is this a DerInteger?
 
scc::crypto::Bignuminteger ()
 Return reference to a scc::crypto::Bignum. More...
 
bool is_bit_string () const
 Is this a DerBitString?
 
BitStringbit_string ()
 Return reference to bit string.
 
bool is_octet_string () const
 Is this an octet string (8 bit chars)?
 
bool is_printable_string () const
 Is this a printable string?
 
bool is_utf8_string () const
 Is this a utf8 (ascii) string?
 
bool is_ia5_string () const
 Is this an ia5 (ascii) string?
 
bool is_bmp_string () const
 Is this a bmp (ascii) string?
 
bool is_universal_string () const
 Is this a univeral (ascii) string?
 
bool is_teletex_string () const
 Is this a teletex (ascii) string?
 
bool is_visible_string () const
 Is this a visible (ascii) string?
 
bool is_string () const
 Is this a generic ascii string?
 
std::string string ()
 Return string.
 
void string (const std::string &)
 Set the string.
 
void string_get (std::vector< char > &)
 Get string vector.
 
void string_get (std::vector< uint8_t > &)
 
void string_set (const std::vector< char > &)
 Set string vector.
 
void string_set (const std::vector< uint8_t > &)
 
bool is_null () const
 Is this a null type?
 
bool is_boolean () const
 Is this a boolean type?
 
bool boolean ()
 Return boolean value.
 
void boolean (bool)
 Set boolean value.
 
bool is_utc_time () const
 Is this a utc time type?
 
bool is_generalized_time () const
 Is this as generalized time type?
 
bool is_time () const
 Is this a time type?
 
time_t time_epoch ()
 Epoch time. More...
 
std::chrono::system_clock::time_point time_point ()
 Time point.
 
bool is_object_id () const
 Is this an object identifier?
 
oid_value object_id ()
 Return the object identifier value.
 
void object_id (const oid_value &)
 Set the object identifier.
 

Protected Attributes

time_t m_t
 
- Protected Attributes inherited from scc::crypto::DerBase
uint8_t m_tag
 
uint32_t m_id
 

Additional Inherited Members

- Public Types inherited from scc::crypto::DerBase
enum  Tag {
  id_mask = 0x1f , construct_mask = 0x20 , class_mask = 0xc0 , class_application = 0x40 ,
  class_context = 0x80 , class_private = 0xc0 , length_multi_mask = 0x80 , length_bytes_mask = 0x7f ,
  type_boolean = 1 , type_integer = 2 , type_bit_string = 3 , type_octet_string = 4 ,
  type_null = 5 , type_object_identifier = 6 , type_utf8_string = 12 , type_sequence = 16 ,
  type_set = 17 , type_printable_string = 19 , type_teletex_string = 20 , type_ia5_string = 22 ,
  type_utc_time = 23 , type_generalized_time = 24 , type_visible_string = 26 , type_universal_string = 28 ,
  type_bmp_string = 30
}
 
- Static Public Member Functions inherited from scc::crypto::DerBase
static BasePtr create (int)
 Create a base pointer, using only the tag byte.
 
static BasePtr create (const std::vector< uint8_t > &, size_t)
 Create a base pointer, with extended header bytes.
 
static BasePtr context_to_explicit (const BasePtr &)
 Change a context element to explicit. More...
 
static BasePtr explicit_to_context (const BasePtr &BasePtr, uint32_t)
 Convert explicit to context. More...
 
static BasePtr context_to_implicit (const BasePtr &, uint32_t)
 Change a context element to implicit. More...
 
static BasePtr implicit_to_context (const BasePtr &BasePtr, uint32_t)
 Convert implicit to context. More...
 

Detailed Description

Time base class.

Time values can be read in any format, and are stored in epoch time in the local time zone.

Epoch time is seconds since January 1, 1970.

Definition at line 595 of file der.h.


The documentation for this class was generated from the following files: