Next: , Up: Basic Structures   [Contents][Index]


2.2.1 Data Types

LibTMCG provides several data structures for cards, stacks, and cryptographic keys.

2.2.1.1 Encoding Schemes for Cards

There exist two different encoding schemes that can be used for the digital representation of playing cards. In the scheme of Schindelhauer [Sc98] the type of a card is shared among the players through bit-wise representation by quadratic (non-)residues. Thus the security relies on the well-known QRA (Quadratic Residuosity Assumption). Unfortunately, the size of a card grows linearly in the number of players and logarithmically in the number of card types. Recently the much more efficient solution of Barnett and Smart [BS03] has been implemented. This encoding works on a cyclic group of prime order and requires that the DDH (Decisional Diffie-Hellman Assumption) holds there.

For both schemes LibTMCG provides a structure whose name contains the suffix Card. This data type is used to represent an open or even a masked card. Further, there is a corresponding structure whose name contains the suffix CardSecret. This data type is used to represent the secret values involved in a card masking operation.

Because of the reduced computational and communication complexity (see [St05] for more details) the usage of the second card encoding scheme, i.e. VTMF_Card and VTMF_CardSecret, is highly recommended.

Data type: TMCG_Card

This struct represents a card in the encoding scheme of Schindelhauer [Sc98]. The type of the card is shared among the players by quadratic residues and non-residues, respectively. Thus the security relies on the Quadratic Residuosity Assumption.

Member of TMCG_Card: std::vector< std::vector<MP_INT> > z

This k\times w-matrix encodes the type of the corresponding card in a shared way. For each of the k players there is a separate row and for each of the w bits in the binary representation of the type there is a column. The elements are numbers from the group {\bf Z}^{\circ}_{m_i} where m_i is the public modulus of the ith player.

Constructor on TMCG_Card: TMCG_Card ()

This default constructor initializes the card with an empty 1\times 1-matrix. Later the method TMCG_Card::resize can be used to enlarge the card representation.

Constructor on TMCG_Card: TMCG_Card (size_t k, size_t w)

This constructor initializes the card with an empty k\times w-matrix. The parameter k is the number of players and w is the maximum number of bits used by the binary representation of the card type.

Constructor on TMCG_Card: TMCG_Card (const TMCG_Card& that)

This is a simple copy-constructor and that is the card to be copied.

Operator on TMCG_Card: TMCG_Card& = (const TMCG_Card& that)

This is a simple assignment-operator and that is the card to be assigned.

Operator on TMCG_Card: bool == (const TMCG_Card& that)

This operator tests two card representations for equality.

Operator on TMCG_Card: bool != (const TMCG_Card& that)

This operator tests two card representations for inequality.

Method on TMCG_Card: void resize (size_t k, size_t w)

This method resizes the representation of the card. The current content of the member z will be released and a new k\times w-matrix is created. The parameter k is the number of players and w is the maximum number of bits used by the binary representation of the card type.

Method on TMCG_Card: bool import (std::string s)

This method imports the content of the member z from the correctly formatted input string s. It returns true, if the import was successful.

Destructor on TMCG_Card: ~TMCG_Card ()

This destructor releases all occupied resources.

Operator on TMCG_Card: std::ostream& << (std::ostream& out, const TMCG_Card& card)

This operator exports the content of the member z (of the given TMCG_Card card) to the output stream out.

Operator on TMCG_Card: std::istream& >> (std::istream& in, TMCG_Card& card)

This operator imports the content of the member z (of the given TMCG_Card card) from the input stream in. The data has to be delimited by a newline character. The failbit of the stream is set, if any parse error occurred.

Data type: TMCG_CardSecret

This struct represents the secret used for a card masking operation in the original encoding scheme of Schindelhauer [Sc98].

Member of TMCG_CardSecret: std::vector< std::vector<MP_INT> > r

This k\times w-matrix encodes the first part of the secret. For each of the k players there is a separate row and for each of the w bits in the binary representation of the corresponding card type there is a column. The elements are numbers from the group {\bf Z}^{\circ}_{m_i} where m_i is the public modulus of the ith player.

Member of TMCG_CardSecret: std::vector< std::vector<MP_INT> > b

This k\times w-matrix encodes the second part of the secret. For each of the k players there is a separate row and for each of the w bits in the binary representation of the corresponding card type there is a column. The elements are simply numbers from \{0, 1\}.

Constructor on TMCG_CardSecret: TMCG_CardSecret ()

This default constructor initializes both members with an empty 1\times 1-matrix. Later the method TMCG_CardSecret::resize can be used to enlarge the card representation.

Constructor on TMCG_CardSecret: TMCG_CardSecret (size_t k, size_t w)

This constructor initializes both members with an empty k\times w-matrix. The parameter k is the number of players and w is the maximum number of bits used by the binary representation of the corresponding card type.

Constructor on TMCG_CardSecret: TMCG_CardSecret (const TMCG_CardSecret& that)

This is a simple copy-constructor and that is the secret to be copied.

Operator on TMCG_CardSecret: TMCG_CardSecret& = (const TMCG_CardSecret& that)

This is a simple assignment-operator and that is the secret to be assigned.

Method on TMCG_CardSecret: void resize (size_t k, size_t w)

This method resizes the representation of the secret. The current content of the members r and b will be released and new k\times w-matrices are created. The parameter k is the number of players and w is the maximum number of bits used by the binary representation of the corresponding card type.

Method on TMCG_CardSecret: bool import (std::string s)

This method imports the content of the members r and b from the correctly formatted input string s. It returns true, if the import was successful.

Destructor on TMCG_CardSecret: ~TMCG_CardSecret ()

This destructor releases all occupied resources.

Operator on TMCG_CardSecret: std::ostream& << (std::ostream& out, const TMCG_CardSecret& cardsecret)

This operator exports the content of the members r and b (of the given TMCG_CardSecret cardsecret) to the output stream out.

Operator on TMCG_CardSecret: std::istream& >> (std::istream& in, TMCG_CardSecret& cardsecret)

This operator imports the content of the members r and b (of the given TMCG_CardSecret cardsecret) from the input stream in. The data has to be delimited by a newline character. The failbit of the stream is set, if any parse error occurred.

Data type: VTMF_Card

This struct represents a card in the encoding scheme of Barnett and Smart [BS03]. Here we use the discrete logarithm based instantiation of their general cryptographic primitive VTMF (Verifiable k-out-of-k Threshold Masking Function). The security relies on the DDH assumption in the underlying abelian group G.

Member of VTMF_Card: mpz_t c_1

This is the first part of the encrypted card type. It is an element from the underlying group G.

Member of VTMF_Card: mpz_t c_2

This is the second part of the encrypted card type. It is also an element from the underlying group G.

Constructor on VTMF_Card: VTMF_Card ()

This default constructor initializes an empty card where the members c_1 and c_2 are set to zero.

Constructor on VTMF_Card: VTMF_Card (const VTMF_Card& that)

This is a simple copy-constructor and that is the card to be copied.

Operator on VTMF_Card: VTMF_Card& = (const VTMF_Card& that)

This is a simple assignment-operator and that is the card to be assigned.

Operator on VTMF_Card: bool == (const VTMF_Card& that)

This operator tests two card representations for equality.

Operator on VTMF_Card: bool != (const VTMF_Card& that)

This operator tests two card representations for inequality.

Method on VTMF_Card: bool import (std::string s)

This method imports the content of the members c_1 and c_2 from a correctly formatted input string s. It returns true, if the import was successful.

Destructor on VTMF_Card: ~VTMF_Card ()

This destructor releases all occupied resources.

Operator on VTMF_Card: std::ostream& << (std::ostream& out, const VTMF_Card& card)

This operator exports the content of the members c_1 and c_2 (of the given VTMF_Card card) to the output stream out.

Operator on VTMF_Card: std::istream& >> (std::istream& in, VTMF_Card& card)

This operator imports the content of the members c_1 and c_2 (of the given VTMF_Card card) from the input stream in. The data has to be delimited by a newline character. The failbit of the stream is set, if any parse error occurred.

Data type: VTMF_CardSecret

This struct represents the secrets used in the card masking operation by the encoding scheme of Barnett and Smart [BS03].

Member of VTMF_CardSecret: mpz_t r

This member is the exponent (randomizer) used in the masking operation. It should be chosen uniformly and randomly from {\bf Z}_q where q is the order of the finite abelian group G for which the DDH assumption holds.

According to the results of Koshiba and Kurosawa (see Short Exponent Diffie-Hellman Problems, PKC 2004, LNCS 2947) the length of this exponent can be shorten to a more efficient size (e.g. 160 bit), if the corresponding generator of G is adjusted as well. Under the additional DLSE (Discrete Logarithm with Short Exponents) assumption the DDH problem in G seems to be still hard. By such an optimization trick we gain a great performance advantage for almost all modular exponentiations that are computed during the masking operation, if the VTMF primitive was instantiated by the later explained class BarnettSmartVTMF_dlog_GroupQR. Furthermore, the size of the card secret is substantially reduced which results in an improved communication complexity.

Constructor on VTMF_CardSecret: VTMF_CardSecret ()

This default constructor initializes the secret with an empty member r.

Constructor on VTMF_CardSecret: VTMF_CardSecret (const VTMF_CardSecret& that)

This is a simple copy-constructor and that is the secret to be copied.

Operator on VTMF_CardSecret: VTMF_CardSecret& = (const VTMF_CardSecret& that)

This is a simple assignment-operator and that is the secret to be assigned.

Method on VTMF_CardSecret: bool import (std::string s)

This method imports the content of the member r from the correctly formatted input string s. It returns true, if the import was successful.

Destructor on VTMF_CardSecret: ~VTMF_CardSecret ()

This destructor releases all occupied resources.

Operator on VTMF_CardSecret: std::ostream& << (std::ostream& out, const VTMF_CardSecret& cardsecret)

This operator exports the content of the member r (of the given VTMF_CardSecret cardsecret) to the output stream out.

Operator on VTMF_CardSecret: std::istream& >> (std::istream& in, VTMF_CardSecret& cardsecret)

This operator imports the content of the member r (of the given VTMF_CardSecret cardsecret) from the input stream in. The data has to be delimited by a newline character. The failbit of the stream is set, if any parse error occurred.

2.2.1.2 Stacks

All of the following data types are generic containers that can be instantiated as C++ templates with the former explained Card and CardSecret data types, respectively. Note the maximum number of stackable data is upper-bounded by TMCG_MAX_CARDS. There is no error reported, if this limit is exceeded.

Data type: TMCG_Stack<CardType>

This struct is a simple container for cards of the specified CardType. Currently, the elements can be either of type TMCG_Card or VTMF_Card depending on which kind of encoding scheme is used. The TMCG_Stack structure is mainly used to represent a stack of masked cards, i.e., playing cards that are stacked in a face-down manner. It can be either a public stack where all participants have access to or even a private stack, e.g. the players’ hand. If the corresponding card types are known it can also serve as an “open stack”, although TMCG_OpenStack is more suitable in that case.

Member of TMCG_Stack: std::vector<CardType> stack

This is the container that is used internally for storing the cards.

Constructor on TMCG_Stack: TMCG_Stack ()

This default constructor initializes an empty stack.

Operator on TMCG_Stack: TMCG_Stack& = (const TMCG_Stack<CardType>& that)

This is a simple assignment-operator and that is the stack to be assigned.

Operator on TMCG_Stack: bool == (const TMCG_Stack<CardType>& that)

This operator tests two stacks for equality. It checks whether the sizes of the stacks and the contained cards are equal with respect to the implied order.

Operator on TMCG_Stack: bool != (const TMCG_Stack<CardType>& that)

This operator tests two stacks for inequality. It returns true, if either the sizes do not match or at least two corresponding cards are not equal.

Operator on TMCG_Stack: const CardType& [] (const size_t n)

This operator provides read-only random access to the contained cards. It returns a const-reference to the nth card from the top of the stack.

Operator on TMCG_Stack: CardType& [] (const size_t n)

This operator provides random access to the contained cards. It returns a reference to the nth card from the top of the stack.

Method on TMCG_Stack: size_t size ()

This method returns the size of the stack.

Method on TMCG_Stack: void push (const CardType& c)

This method pushes the card c to the back of the stack.

Method on TMCG_Stack: void push (const TMCG_Stack<CardType>& s)

This method pushes the stack s to the back of the stack.

Method on TMCG_Stack: void push (const TMCG_OpenStack<CardType>& s)

This method pushes the cards of the open stack s to the back of the stack.

Method on TMCG_Stack: bool empty ()

This method returns true, if the stack is empty.

Method on TMCG_Stack: bool pop (CardType& c)

This method removes a card from the back and stores the data in c. It returns true, if the stack was not empty and thus c contains useful data.

Method on TMCG_Stack: void clear ()

This method clears the stack, i.e., it removes all cards.

Method on TMCG_Stack: bool find (const CardType& c)

This method returns true, if the card c was found in the stack.

Method on TMCG_Stack: bool remove (const CardType& c)

This method removes the top-most card from the stack which is equal to c. It returns true, if the card was found and successfully removed.

Method on TMCG_Stack: size_t removeAll (const CardType& c)

This method removes every card from the stack which is equal to c. It returns the number of removed cards.

Method on TMCG_Stack: bool import (std::string s)

This method imports the stack from the correctly formatted input string s. It returns true, if the import was successful.

Destructor on TMCG_Stack: ~TMCG_Stack ()

This destructor releases all occupied resources.

Operator on TMCG_Stack: std::ostream& << (std::ostream& out, const TMCG_Stack<CardType>& stack)

This operator exports the given stack to the output stream out.

Operator on TMCG_Stack: std::istream& >> (std::istream& in, TMCG_Stack<CardType>& stack)

This operator imports the given stack from the input stream in. The data has to be delimited by a newline character. The failbit of the stream is set, if any parse error occurred.

Data type: TMCG_OpenStack<CardType>

This struct is a simple container for cards of the specified CardType whose types are known. The elements are pairs where the first component is the type and the second component is the corresponding card. The card type is represented by a size_t integer. Currently, the cards can be either of type TMCG_Card or VTMF_Card depending on which kind of encoding scheme is used.

Member of TMCG_OpenStack: std::vector<std::pair<size_t, CardType> > stack

This is the container that is used internally for storing the pairs.

Constructor on TMCG_OpenStack: TMCG_OpenStack ()

This default constructor initializes an empty stack.

Operator on TMCG_OpenStack: TMCG_OpenStack& = (const TMCG_OpenStack<CardType>& that)

This is a simple assignment-operator and that is the stack to be assigned.

Operator on TMCG_OpenStack: bool == (const TMCG_OpenStack<CardType>& that)

This operator tests two stacks for equality. It checks whether the types, the sizes, and the contained cards are equal with respect to the stack order.

Operator on TMCG_OpenStack: bool != (const TMCG_OpenStack<CardType>& that)

This operator tests two stacks for inequality. It returns true, if either the sizes resp. types do not match or at least two corresponding cards are not equal.

Operator on TMCG_OpenStack: const std::pair<size_t, CardType>& [] (const size_t n)

This operator provides read-only random access to the contained pairs. It returns a const-reference to the nth pair from the top of the stack.

Operator on TMCG_OpenStack: std::pair<size_t, CardType>& [] (const size_t n)

This operator provides random access to the contained pairs. It returns a reference to the nth pair from the top of the stack.

Method on TMCG_OpenStack: size_t size ()

This method returns the size of the stack.

Method on TMCG_OpenStack: void push (const std::pair<size_t, CardType>& p)

This method pushes the pair p to the back of the stack. The first component is the type and the second component is the corresponding card representation.

Method on TMCG_OpenStack: void push (const size_t type, const CardType& c)

This method pushes a pair to the back of the stack. The parameter type is the card type and c is the corresponding card representation.

Method on TMCG_OpenStack: void push (const TMCG_OpenStack<CardType>& s)

This method pushes the pairs of the stack s to the back of this stack.

Method on TMCG_OpenStack: bool empty ()

This method returns true, if the stack is empty.

Method on TMCG_OpenStack: bool pop (size_t& type, CardType& c)

This method removes a pair from the back of the stack. It stores the card type in type and the representation in c. It returns true, if the stack was not empty and thus type and c contain useful data.

Method on TMCG_OpenStack: void clear ()

This method clears the stack, i.e., it removes all pairs.

Method on TMCG_OpenStack: bool find (const size_t type)

This method returns true, if a pair with the first component type was found in the stack.

Method on TMCG_OpenStack: bool remove (const size_t type)

This method removes the top-most pair with the first component type from the stack. It returns true, if such a pair was found and successfully removed.

Method on TMCG_OpenStack: size_t removeAll (const size_t type)

This method removes every pair from the stack whose first component is equal to type. Further it returns the number of removed pairs.

Method on TMCG_OpenStack: bool move (const size_t type, TMCG_Stack<CardType>& s)

This method moves the top-most card representation of the given type to another stack s. It returns true, if such a pair was found and successfully moved.

Destructor on TMCG_OpenStack: ~TMCG_OpenStack ()

This destructor releases all occupied resources.

Data type: TMCG_StackSecret<CardSecretType>

This struct is a simple container for the secrets involved in the masking operation of cards. Additionally, the permutation of a corresponding shuffle of the stack is stored. The elements are pairs where the first component is a permutation index of type size_t and the second component is a card secret of the specified CardSecretType. Currently, such secrets can be either of type TMCG_CardSecret or VTMF_CardSecret depending on which kind of encoding scheme is used.

Member of TMCG_StackSecret: std::vector<std::pair<size_t, CardSecretType> > stack

This is the container that is used internally for storing the pairs.

Constructor on TMCG_StackSecret: TMCG_StackSecret ()

This default constructor initializes an empty stack secret.

Operator on TMCG_StackSecret: TMCG_StackSecret& = (const TMCG_StackSecret<CardSecretType>& that)

This is a simple assignment-operator and that is the stack secret to be assigned.

Operator on TMCG_StackSecret: const std::pair<size_t, CardSecretType>& [] (const size_t n)

This operator provides read-only random access to the contained pairs. It returns a const-reference to the nth pair from the top of the stack secret.

Operator on TMCG_StackSecret: std::pair<size_t, CardSecretType>& [] (const size_t n)

This operator provides random access to the contained pairs. It returns a reference to the nth pair from the top of the stack secret.

Method on TMCG_StackSecret: size_t size ()

This method returns the size of the stack secret.

Method on TMCG_StackSecret: void push (const size_t index, const CardSecretType& cs)

This method pushes a pair to the back of the stack secret. The parameter index is the permutation index and cs is the corresponding card secret.

Method on TMCG_StackSecret: void clear ()

This method clears the stack secret, i.e., it removes all pairs.

Method on TMCG_StackSecret: size_t find_position (const size_t index)

This method searches for a given permutation index in the stack secret. It returns the corresponding position7 in the stack secret, if the index was found. Otherwise, the size of the stack secret is returned. Please note that in this case the returned value is not a valid position for an access to the stack secret.

Method on TMCG_StackSecret: bool find (const size_t index)

This method searches for a given permutation index in the stack secret. It returns true, if such an index was found.

Method on TMCG_StackSecret: bool import (std::string s)

This method imports the stack secret from a correctly formatted input string s. It returns true, if the import was successful.

Destructor on TMCG_StackSecret: ~TMCG_StackSecret ()

This destructor releases all occupied resources.

Operator on TMCG_StackSecret: std::ostream& << (std::ostream& out, const TMCG_StackSecret<CardSecretType>& stacksecret)

This operator exports the given stacksecret to the output stream out.

Operator on TMCG_StackSecret: std::istream& >> (std::istream& in, TMCG_StackSecret<CardSecretType>& stacksecret)

This operator imports the given stacksecret from the input stream in. The data has to be delimited by a newline character. The failbit of the stream is set, if any parse error occurred.

2.2.1.3 Cryptographic Keys

LibTMCG provides corresponding data types for keys used by the encoding scheme of Schindelhauer [Sc98], because in this scheme it is not efficient to perform the process of key generation for every new game session. These keys are called TMCG keys. However, they also can be utilized to encrypt and sign messages for the more general reasons of confidentiality and integrity, even if the card encoding scheme of Schindelhauer is not used. Therefore these structures may be of independent interest, for example to establish authenticated communication channels between players. However, like for all public key cryptosystems a trusted PKI (Public Key Infrastructure) is needed. This might not be a serious problem in distributed game environments, because the players can include key fingerprints in their individual profile or a service provider can issue public key certificates.

Data type: TMCG_SecretKey

This struct represents the secret part of the key. The underlying public key cryptosystem is due to Rabin (see Digitalized Signatures and Public-Key Functions as Intractable as Factorization, MIT Technical Report 212, 1979) and Williams (see A modification of the RSA public-key encryption procedure, IEEE Transactions on Information Theory, 26(6):726–729, 1980) with minor modifications for encryption padding (SAEP scheme of Boneh [Bo01]) and digital signatures (PRab scheme of Bellare and Rogaway [BR96]).

Member of TMCG_SecretKey: std::string name

This string contains the name or a pseudonym of the key owner.

Member of TMCG_SecretKey: std::string email

This string contains the email address of the key owner.

Member of TMCG_SecretKey: std::string type

This string contains information about the key type. The common prefix is TMCG/RABIN. It is followed by the decimal encoded bit size of the modulus m. The suffix NIZK signals that the correctness of the key is shown by an appended non-interactive zero-knowledge proof. The single parts of the description are separated by underscore characters _, e.g., TMCG/RABIN_2048_NIZK has the correct form. The suffix can be left empty, if the key is only used for encryption and signing (so-called non-NIZK key) without card encoding.

Member of TMCG_SecretKey: std::string nizk

This string contains two stages of the non-interactive zero-knowledge proof of Gennaro, Micciancio, and Rabin [GMR98]. The proof shows that m was correctly generated as product of at most two primes and both are congruent to 3 (modulo 4). Further there is another non-interactive zero-knowledge proof appended which shows that the condition y\in{\bf NQR}^\circ_m holds.

Member of TMCG_SecretKey: std::string sig

This string contains a self signature of the public key.

Member of TMCG_SecretKey: mpz_t m

This is the public modulus m = p \cdot q which is the product of two secret primes p and q. The size of m is determined by the security parameter TMCG_QRA_SIZE.

Member of TMCG_SecretKey: mpz_t y

This is the public quadratic non-residue y\in {\bf NQR}^\circ_m which is used in several zero-knowledge proofs of Schindelhauer’s encoding scheme [Sc98].

Member of TMCG_SecretKey: mpz_t p

This is the secret prime number p which is a factor of the modulus m.

Member of TMCG_SecretKey: mpz_t q

This is the secret prime number q which is a factor of the modulus m.

Constructor on TMCG_SecretKey: TMCG_SecretKey ()

This default constructor initializes an empty secret key.

Constructor on TMCG_SecretKey: TMCG_SecretKey (const std::string& n, const std::string& e, const unsigned long int keysize =TMCG_QRA_SIZE, const bool nizk_key =true)

This constructor generates a new secret key, where n is the name or a pseudonym of the owner, e is a corresponding email address, keysize is the desired bit length of the modulus m, and nizk_key indicates whether or not a NIZK proof will be appended. The default value of the third argument is set to TMCG_QRA_SIZE, if keysize is omitted in the call. The default value of the fourth argument is set to true, whenever it is omitted in the call. Depending on keysize and nizk_key the generation is a very time-consuming task that should be taken into account by the application designer.

Constructor on TMCG_SecretKey: TMCG_SecretKey (const std::string& s)

This constructor initializes the key from a correctly formatted input string s.

Constructor on TMCG_SecretKey: TMCG_SecretKey (const TMCG_SecretKey& that)

This is a simple copy-constructor and that is the key to be copied.

Operator on TMCG_SecretKey: TMCG_SecretKey& = (const TMCG_SecretKey& that)

This is a simple assignment-operator and that is the key to be assigned.

Method on TMCG_SecretKey: bool check ()

This method tests whether the self signature is valid and whether the non-interactive zero-knowledge proofs are sound. It returns true, if all checks have been successfully passed. Due to the computational complexity of the verification procedure these checks are a very time-consuming task.

Method on TMCG_SecretKey: std::string fingerprint ()

This method returns the fingerprint of the key. The fingerprint is the hexadecimal notation of the hash value (using algorithm TMCG_GCRY_MD_ALGO) on the concatenated members name, email, type, m, y, nizk, and sig.

Method on TMCG_SecretKey: std::string selfid ()

This method returns the real value of the self signature. The string ERROR is returned, if any parse error occurred. The string SELFSIG-SELFSIG-SELFSIG-SELFSIG-SELFSIG-SELFSIG is returned, if the self signature sig was empty.

Method on TMCG_SecretKey: std::string keyid (const size_t size =TMCG_KEYID_SIZE)

This method returns the unique key identifier of length size. The default value of the first argument is set to TMCG_KEYID_SIZE, if size is omitted in the call.

Method on TMCG_SecretKey: size_t keyid_size (const std::string& s)

This method returns the length of the unique key identifier s. Zero is returned, if any parse error occurred.

Method on TMCG_SecretKey: std::string sigid (std::string s)

This method returns the unique key identifier which is included in the signature s. The string ERROR is returned, if any parse error occurred.

Method on TMCG_SecretKey: bool import (std::string s)

This method imports the key from a correctly formatted input string s. It returns true, if the import was successful.

Method on TMCG_SecretKey: bool decrypt (unsigned char* value, std::string s)

This method decrypts the given encryption packet s and stores the content in value which is a pointer to a character array of size TMCG_SAEP_S0. The method returns true, if the decryption was successful.

Method on TMCG_SecretKey: std::string sign (const std::string& data)

This method returns a digital signature on data.

Method on TMCG_SecretKey: std::string encrypt (const unsigned char* value)

This method encrypts the content of value which is a pointer to a character array of size TMCG_SAEP_S0. The method returns a corresponding encryption packet that can be decrypted by the owner of the secret key.

Method on TMCG_SecretKey: bool verify (const std::string& data, std::string s)

This method verifies whether the signature s on data is valid or not. It returns true, if everything was sound.

Destructor on TMCG_SecretKey: ~TMCG_SecretKey ()

This destructor releases all occupied resources.

Operator on TMCG_SecretKey: std::ostream& << (std::ostream& out, const TMCG_SecretKey& key)

This operator exports the given key to the output stream out.

Operator on TMCG_SecretKey: std::istream& >> (std::istream& in, TMCG_SecretKey& key)

This operator imports the given key from the input stream in. The data has to be delimited by a newline character. The failbit is set, if any parse error occurred.

Data type: TMCG_PublicKey

This struct represents the public part of the TMCG key.

Member of TMCG_PublicKey: std::string name

This string contains the name or a pseudonym of the key owner.

Member of TMCG_PublicKey: std::string email

This string contains the email address of the key owner.

Member of TMCG_PublicKey: std::string type

This string contains information about the key type. The common prefix is TMCG/RABIN. It is followed by the decimal encoded bit size of the modulus m. The suffix NIZK signals that the correctness of the key is shown by an appended non-interactive zero-knowledge proof. The single parts of the string are separated by underscore characters _, e.g., TMCG/RABIN_2048_NIZK has the correct form. However, the suffix can be left empty, if the key is only used for encryption and signing.

Member of TMCG_PublicKey: std::string nizk

This string contains two stages of non-interactive zero-knowledge proof of Gennaro, Micciancio and Rabin [GMR98]. This gives strong evidence that m was generated correctly. Further there is another non-interactive zero-knowledge proof appended which shows that the condition y\in{\bf NQR}^\circ_m holds.

Member of TMCG_PublicKey: std::string sig

This string contains the self signature of the public key.

Member of TMCG_PublicKey: mpz_t m

This is the public modulus m = p \cdot q which is the product of two secret primes p and q. The size of m is determined by the security parameter TMCG_QRA_SIZE.

Member of TMCG_PublicKey: mpz_t y

This is the public quadratic non-residue y\in {\bf NQR}^\circ_m which is used by several zero-knowledge proofs of the toolbox.

Constructor on TMCG_PublicKey: TMCG_PublicKey ()

This default constructor initializes an empty public key.

Constructor on TMCG_PublicKey: TMCG_PublicKey (const TMCG_SecretKey& skey)

This constructor initializes the key using public values of the secret key skey.

Constructor on TMCG_PublicKey: TMCG_PublicKey (const TMCG_PublicKey& pkey)

This is a simple copy-constructor and pkey is the key to be copied.

Operator on TMCG_PublicKey: TMCG_PublicKey& = (const TMCG_PublicKey& that)

This is a simple assignment-operator and that is the key to be assigned.

Method on TMCG_PublicKey: bool check ()

This method tests whether the self signature is valid and whether the non-interactive zero-knowledge proofs are sound. It returns true, if all checks have been successfully passed. Due to the computational complexity of the verification procedure these checks are an extremely time-consuming task.

Method on TMCG_PublicKey: std::string fingerprint ()

This method returns the fingerprint of the key. The fingerprint is the hexadecimal notation of the hash value (using algorithm TMCG_GCRY_MD_ALGO) on the concatenated members name, email, type, m, y, nizk, and sig.

Method on TMCG_PublicKey: std::string selfid ()

This method returns the real value of the self signature. The string ERROR is returned, if any parse error occurred. The string SELFSIG-SELFSIG-SELFSIG-SELFSIG-SELFSIG-SELFSIG is returned, if the self signature sig was empty.

Method on TMCG_PublicKey: std::string keyid (const size_t size =TMCG_KEYID_SIZE)

This method returns the unique key identifier of length size. The default value of the first argument is set to TMCG_KEYID_SIZE, if size is omitted in the call.

Method on TMCG_PublicKey: size_t keyid_size (const std::string& s)

This method returns the length of the unique key identifier s. Zero is returned, if any parse error occurred.

Method on TMCG_PublicKey: std::string sigid (std::string s)

This method returns the unique key identifier which is included in the signature s. The string ERROR is returned, if any parse error occurred.

Method on TMCG_PublicKey: bool import (std::string s)

This method imports the key from a correctly formatted input string s. It returns true, if the import was successful.

Method on TMCG_PublicKey: std::string encrypt (const unsigned char* value)

This method encrypts the content of value which is a pointer to a character array of size TMCG_SAEP_S0. The method returns a corresponding encryption packet that can be decrypted by the owner of the secret key.

Method on TMCG_PublicKey: bool verify (const std::string& data, std::string s)

This method verifies whether the signature s on data is valid or not. It returns true, if everything was sound.

Destructor on TMCG_PublicKey: ~TMCG_PublicKey ()

This destructor releases all occupied resources.

Operator on TMCG_PublicKey: std::ostream& << (std::ostream& out, const TMCG_PublicKey& key)

This operator exports the given key to the output stream out.

Operator on TMCG_PublicKey: std::istream& >> (std::istream& in, TMCG_PublicKey& key)

This operator imports the given key from the input stream in. The data has to be delimited by a newline character. The failbit is set, if any parse error occurred.

Data type: TMCG_PublicKeyRing

This struct is just a simple container for TMCG public keys. There are no particular methods provided by TMCG_PublicKeyRing. You have to use the regular interface of the STL container std::vector to access the single keys of the ring.

Member of TMCG_PublicKeyRing: std::vector<TMCG_PublicKey> keys

This is the real container that is used to store the keys.

Constructor on TMCG_PublicKeyRing: TMCG_PublicKeyRing ()

This default constructor initializes an empty public key ring.

Constructor on TMCG_PublicKeyRing: TMCG_PublicKeyRing (size_t n)

This constructor initializes the container for storing exactly n keys.

Destructor on TMCG_PublicKeyRing: ~TMCG_PublicKeyRing ()

This destructor releases all occupied resources.


Footnotes

(7)

According to the behavior of the []-operator, the zero denotes always the top-most position.


Next: , Up: Basic Structures   [Contents][Index]