Constructs and parses key property lists, see Key Properties.
More...
Constructs and parses key property lists, see Key Properties.
This class provides methods to ...
-
set / get property values, see Key Properties
-
parses a serialized, TLV encoded property list and create PropertyList object (property table)
-
create serialized property list from PropertyList object
The following example illustrates the usage of the PropertyList class:
Key desKey =
cxi->key_import(CXI_KEY_FLAG_OVERWRITE,
keyTemplate,
keyBlob,
NULL);
Encapsulates key handles or key blobs of type 'Backup Blob', see Format of Key Blobs.
Definition: sw/cxi_api_c/def/key.h:19
Constructs and parses key property lists, see Key Properties.
Definition: sw/cxi_api_c/def/propertylist.h:19
void setGroup(const char *group)
Definition: propertylist.cpp:517
void setExport(int expo)
Definition: propertylist.cpp:537
void setName(const char *name)
Definition: propertylist.cpp:510
void setTime(time_t timer)
Definition: propertylist.cpp:657
#define CXI_KEY_BLOB_SIMPLE
Simple blob format (Utimaco)
Definition: fw/cxi/def/cxi_defs.h:288
#define CXI_KEY_EXPORT_ALLOW_PLAIN
Allow clear text key export.
Definition: fw/cxi/def/cxi_defs.h:214
#define CXI_KEY_TYPE_SECRET
Secrect key object.
Definition: fw/cxi/def/cxi_defs.h:271
◆ PropertyList() [1/3]
| PropertyList |
( |
unsigned char * |
p_data, |
|
|
unsigned int |
l_data |
|
) |
| |
Overloaded Constructor: creates property list from given serialized data.
- Parameters
-
| p_data | pointer to serialized property list |
| l_data | length of serialized property list |
◆ PropertyList() [2/3]
Overloaded Constructor: creates property list from given serialized data.
- Parameters
-
| data | serialized property list |
◆ PropertyList() [3/3]
Copy Constructor: creates property list from given property list.
- Parameters
-
◆ ~PropertyList()
Destructor: frees internal resources.
◆ clear()
Clears all property values.
◆ parse() [1/2]
| void parse |
( |
const unsigned char * |
p_data, |
|
|
unsigned int |
l_data |
|
) |
| |
Extracts property values from given serialized property list.
- Parameters
-
| p_data | pointer to serialized property list [TLV coding] |
| l_data | length of serialized property list |
◆ parse() [2/2]
Extracts property values from given serialized property list.
- Parameters
-
| pl | serialized property list [byte array] |
◆ merge()
Merges property values of given property list. Existing property values are overwritten.
- Parameters
-
| pl | property list to merged |
◆ serialize()
Serializes property list.
- Returns
- byte array containg serialized property list [TLV coding]
◆ get()
Returns the specified property value.
- Parameters
-
- Returns
- raw property value
◆ getAlgo()
| int getAlgo |
( |
void |
| ) |
const |
◆ getSize()
| int getSize |
( |
void |
| ) |
const |
Returns the key size.
- Returns
- key size in bits
◆ getCurve()
Returns the name of the elliptic curve.
- Returns
- curve name [zero terminated C-string] or NULL pointer if the key's property list doesn't contain this value.
◆ getGroup()
Returns the key group as C-string.
- Returns
- group [zero terminated C-string] or NULL pointer if the key's property list doesn't contain this value.
- Note
- If the key group is stored as Unicode string the returned string is preceded by '{U}'.
◆ getName()
Returns the key name.
- Returns
- name [zero terminated C-string] or NULL pointer if the key's property list doesn't contain this value.
- Note
- If the key name is stored as Unicode string the string is preceded by '{U}'.
◆ getExport()
| int getExport |
( |
void |
| ) |
const |
◆ getUsage()
| int getUsage |
( |
void |
| ) |
const |
Returns the key usage property.
- Returns
- key usage property (CXI_KEY_USAGE_XXX), see Usage Specifier
◆ getSpecifier()
| int getSpecifier |
( |
void |
| ) |
const |
Returns the key specifier property.
- Returns
- specifier or -1 if the key's property list doesn't contain this value.
- Note
- This value is optional and may be used to distinguish between keys with the same name and group, e.g. to specify a key version.
◆ getLabel()
Returns the key label.
- Returns
- label [zero terminated C-string] or NULL pointer if the key's property list doesn't contain this value.
- Note
- If the key label is stored as Unicode String the string is preceded by '{U}'.
◆ getBlockLength()
| int getBlockLength |
( |
void |
| ) |
const |
Returns the block length of the key.
- Returns
- block length of the key in bytes.
◆ getType()
| int getType |
( |
void |
| ) |
const |
Returns the key type.
- Returns
- key type (CXI_KEY_TYPE_XXX), see Key Types
◆ getDate()
Returns the key generation date.
- Returns
- date [zero terminated C-string] or NULL pointer if the key's property list doesn't contain this value.
- Note
- This function has been superseeded by PropertyList::getDateGen.
◆ getDateGen()
| char * getDateGen |
( |
void |
| ) |
|
Returns the key generation date.
- Returns
- date [zero terminated C-string] or NULL pointer if the key's property list doesn't contain this value.
◆ getDateExp()
| char * getDateExp |
( |
void |
| ) |
|
Returns the key expiration date.
- Returns
- date [zero terminated C-string] or NULL pointer if the key's property list doesn't contain this value.
◆ getTime()
Returns the key generation date.
- Returns
- UNIX time [seconds since 1/1/70] or zero if the key's property list doesn't contain this value.
- Note
- This function has been superseeded by PropertyList::getTimeGen.
◆ getTimeGen()
| time_t getTimeGen |
( |
void |
| ) |
|
Returns the key generation date.
- Returns
- UNIX time [seconds since 1/1/70] or zero if the key's property list doesn't contain this value.
◆ getTimeExp()
| time_t getTimeExp |
( |
void |
| ) |
|
Returns the key expiration date.
- Returns
- UNIX time [seconds since 1/1/70] or zero if the key's property list doesn't contain this value.
◆ getUName()
Returns the unique key name.
- Returns
- unique key name, which is the MD5 hash over group, name and specifier.
- Exceptions
-
| cxi::Exception | in case the property list doesn't contain the unique name or the unique name can't be calculated. |
◆ getMechs()
| const Property & getMechs |
( |
void |
| ) |
const |
Returns allowed mechanisms for key.
- Returns
- key mechanisms as raw property value
◆ getFipsUsage()
| int getFipsUsage |
( |
void |
| ) |
const |
Returns fips specific usage and padding flag
- Returns
- fips usage property
◆ set()
| void set |
( |
int |
idx, |
|
|
const Property & |
property |
|
) |
| |
Sets the specified property value.
- Parameters
-
| idx | property specifier, see Key Properties |
| property | property value to be set |
◆ setAlgo()
Sets the key algorithm.
- Parameters
-
◆ setSize()
Sets the key size.
- Parameters
-
◆ setCurve()
| void setCurve |
( |
const char * |
curve | ) |
|
Sets the name of the elliptic curve.
- Parameters
-
| curve | name [zero terminated C-string] |
◆ setGroup()
| void setGroup |
( |
const char * |
group | ) |
|
Sets the key group.
- Parameters
-
| group | group [zero terminated C-string] |
- Note
- If the group is preceded by '{U}', the string is internally converted to Unicode.
◆ setName()
| void setName |
( |
const char * |
name | ) |
|
Sets the key name.
- Parameters
-
| name | key name [zero terminated C-string] |
- Note
- If the name is preceded by '{U}', the string is converted to Unicode.
◆ setExport()
| void setExport |
( |
int |
expo | ) |
|
Sets the key export property.
- Parameters
-
◆ setUsage()
| void setUsage |
( |
int |
usage | ) |
|
Sets the key usage property.
- Parameters
-
| usage | usage propery value [integer] (CXI_KEY_USAGE_XXX), see Usage Specifier |
◆ setSpecifier()
| void setSpecifier |
( |
int |
spec | ) |
|
Sets the key specifier.
- Parameters
-
- Note
- This optional value can be used to distinguish between keys with the same name and group, e.g. to specify a key version.
◆ setLabel()
| void setLabel |
( |
const char * |
label | ) |
|
Sets the key label.
- Parameters
-
| label | label [zero terminated C-string] |
- Note
- If the given string is preceded by {U}, it will be converted to Unicode.
◆ setType()
Sets the key type.
- Parameters
-
◆ setDate()
| void setDate |
( |
const char * |
date | ) |
|
Sets the key generation or expiration date property.
- Parameters
-
| date | (zero terminated C-string: [CC]YYMMDDHHMMSSZ) |
◆ setDateGen()
| void setDateGen |
( |
const char * |
date | ) |
|
Sets the key generation date property.
- Parameters
-
| date | (zero terminated C-string: [CC]YYMMDDHHMMSSZ) |
◆ setDateExp()
| void setDateExp |
( |
const char * |
date | ) |
|
Sets the key expiration date property.
- Parameters
-
| date | (zero terminated C-string: [CC]YYMMDDHHMMSSZ) |
◆ setTime()
| void setTime |
( |
time_t |
timer | ) |
|
Sets the key generation or expiration date property
- Parameters
-
| timer | UNIX time [seconds since 1/1/70] |
- Note
- This function has been superseeded by PropertyList::setTimeGen
◆ setTimeGen()
| void setTimeGen |
( |
time_t |
timer | ) |
|
Sets the key generation date property
- Parameters
-
| timer | UNIX time [seconds since 1/1/70] |
◆ setTimeExp()
| void setTimeExp |
( |
time_t |
timer | ) |
|
Sets the key expiration date property
- Parameters
-
| timer | UNIX time [seconds since 1/1/70] |
◆ setMechs()
| void setMechs |
( |
int * |
mechs, |
|
|
int |
len |
|
) |
| |
Sets allowed mechanisms for a key.
- Parameters
-
| mechs | mechanism array |
| len | number of mechanisms |
◆ setFipsUsage()
| void setFipsUsage |
( |
int |
usage | ) |
|
Sets fips specific usage and padding flag
- Parameters
-
| usage | signature calculation/verification w/ specific padding or other operation |
◆ operator=()
Copies one instance of a property list to another.
- Parameters
-
◆ operator|=()
Merges to property lists.
- Parameters
-
| pl | property list to be merged |
- Note
- Existing values are overwritten.