Setup has two steps: Format HVE_t, and run QED_Setup.
An example is presented at the end.
- Format the HVE_t
An array of HVE_FORMAT_t variables are used to format our HVE_t. An HVE_FORMAT_t represents the query properties of a sector of the HVE_t.
- Format a Comparison Query:
HVE_FORMAT_t comp = {COMPARISON, value}COMPARISONis a predefined keywordvalueis a positive integer; query will be run on the interval [1,value]
- Format an Equality Query:
HVE_FORMAT_t eq = {EQUALITY}EQUALITYis a predefined keyword
- Format a Subset Query:
HVE_FORMAT_T sub = {SUBSET, prob, sub_size}SUBSETis a predefined keywordprobtakes one of the predefined values:EPS_PT1, EPS_PT01, EPS_PT001
(Please see Param Description Section
for more information on the EPS_PT values)
sub_sizeis a positive integer representing the size of the set the query is ran on.
- Format a Raw Query:
HVE_FORMAT_T raw = {RAW}RAWis a predefined keyword
The arary of HVE_FORMAT_t must be terminated with a triple END. This terminating HVE_FORMAT_t entry should be considered in the length of the HVE_FORMAT_t array.
{ END, END, END };
After the HVE_FORMAT_t array is fully specified, call HVE_Format:
QED_Return HVE_Format( HVE_t *HVE, HVE_FORMAT_t *array, size_t array_len)
- Format a Comparison Query:
- Run QED_Setup
STANDARD, corresponding to 512-bit p and q.STRONG, corresponding to 1024-bit p and q.EXCELLENT, corresponding to 2048-bit p and q.
Setup will be used to generate the private and public keys. These keys will generated with a security parameter used to generate primes p and q in the composite order elliptic curve group (n=pq). (See QED Internals for more information.) The security parameter takes three values:
The formated HVE and the security parameter will be used to generate public and private keys.
QEDPrivateKey_t PrivKey; QEDPublicKey_t PubKey;
Call QED_Setup with the formated HVE and the security parameter to populate the two keys.
int QED_Setup(
QEDPrivateKey_t *PrivKey,
QEDPublicKey_t *PubKey,
HVE_t *HVE,
STANDARD,
QED_CTX *c)
Example
First, declare a context, a private key, a public key and an HVE variable.
QED_CTX c; QEDPrivateKey_t PrivKey; QEDPublicKey_t PubKey; HVE_t HVE;
Second, initialize the context variable to use TYPE1 algorithm.
QED_Init(&c, TYPE1);
Third, format the HVE to the following query:
Note: For more information on the meaning of probability for a subset query please see Param Description Section
The following code will format the declared HVE to the above specifications:
HVE_FORMAT_t format[5] = {
{COMPARISON, 5},
{EQUALITY},
{SUBSET, EPS_PT1, 3},
{RAW},
{END, END, END}};
HVE_Format(&HVE, format, 5);
And finnaly use the formated HVE to generate the public/private pair key, with security parameter
STANDARD:
QED_Setup(&PrivKey, &PubKey, &HVE, STANDARD, &c);