# Intel® Enhanced Privacy ID SDK: member

member
epid

Member functionality. More...

## Data Structures

struct | MemberPrecomp
| Pre-computed member settings. More...
struct | PreComputedSignature
| Pre-computed signature. More...

## Functions

EpidStatus | EpidMemberCreate (GroupPubKey const *pub_key, PrivKey const *priv_key, MemberPrecomp const *precomp, BitSupplier rnd_func, void *rnd_param, MemberCtx **ctx)
| Creates a new member context. More...
void | EpidMemberDelete (MemberCtx **ctx)
| Deletes an existing member context. More...
EpidStatus | EpidMemberWritePrecomp (MemberCtx const *ctx, MemberPrecomp *precomp)
| Serializes the pre-computed member settings. More...
EpidStatus | EpidMemberSetHashAlg (MemberCtx *ctx, HashAlg hash_alg)
| Sets the hash algorithm to be used by a member. More...
size_t | EpidGetSigSize (SigRl const *sig_rl)
| Computes the size in bytes required for a Intel(R) EPID signature. More...
EpidStatus | EpidSign (MemberCtx const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, SigRl const *sig_rl, size_t sig_rl_size, EpidSignature *sig, size_t sig_len)
| Writes a Intel(R) EPID signature. More...
EpidStatus | EpidRegisterBaseName (MemberCtx *ctx, void const *basename, size_t basename_len)
| Registers a basename with a member. More...
EpidStatus | EpidAddPreSigs (MemberCtx *ctx, size_t number_presigs, PreComputedSignature *presigs)
| Extends the member's pool of pre-computed signatures. More...
size_t | EpidGetNumPreSigs (MemberCtx const *ctx)
| Gets the number of pre-computed signatures in the member's pool. More...
EpidStatus | EpidWritePreSigs (MemberCtx *ctx, PreComputedSignature *presigs, size_t number_presigs)
| Serializes pre-computed signatures from the member's pool. More...
EpidStatus | EpidRequestJoin (GroupPubKey const *pub_key, IssuerNonce const *ni, FpElemStr const *f, BitSupplier rnd_func, void *rnd_param, HashAlg hash_alg, JoinRequest *join_request)
| Creates a request to join a group. More...
EpidStatus | EpidSignBasic (MemberCtx const *ctx, void const *msg, size_t msg_len, void const *basename, size_t basename_len, BasicSignature *sig)
| Creates a basic signature for use in constrained environment. More...
EpidStatus | EpidNrProve (MemberCtx const *ctx, void const *msg, size_t msg_len, BasicSignature const *sig, SigRlEntry const *sigrl_entry, NrProof *proof)
| Calculates a non-revoked proof for a single signature based revocation list entry. More...
bool | EpidIsPrivKeyInGroup (GroupPubKey const *pub_key, PrivKey const *priv_key)
| Tests if a member private key is valid without checking revocation. More...
EpidStatus | EpidDecompressPrivKey (GroupPubKey const *pub_key, CompressedPrivKey const *compressed_privkey, PrivKey *priv_key)
| Decompresses compressed member private key. More...

## Detailed Description

Member functionality.

Defines the APIs needed by Intel(R) EPID members. Each member context (MemberCtx) represents membership in a single group.

## Function Documentation

EpidStatus EpidAddPreSigs | ( | MemberCtx * | ctx,
|  | size_t | number_presigs,
|  | PreComputedSignature * | presigs
| ) |  |

Extends the member's pool of pre-computed signatures.

Can either generate new pre-computed signatures or import existing ones. EpidWritePreSigs can be used to export pre-computed signatures.

Parameters

  [in] | ctx | The member context.
  [in] | number_presigs | The number of pre-computed signatures to add to the internal pool.
  [in,out] | presigs | Optional array of valid pre-computed signatures to import. If presigs is not NULL it most contain at least number_presigs pre-computed signatures.

Returns
  EpidStatus

Note
  presigs buffer is zeroed out before return to prevent pre-computed signatures from being reused.
  If the result is not kEpidNoErr the state of the pre-computed signature pool, and of presigs, is undefined.

See also
  EpidMemberCreate
  EpidWritePreSigs

EpidStatus EpidDecompressPrivKey | ( | GroupPubKey const * | pub_key,
|  | CompressedPrivKey const * | compressed_privkey,
|  | PrivKey * | priv_key
| ) |  |

Decompresses compressed member private key.

Converts a compressed member private key into a member private key for use by other member APIs.

Parameters

  [in] | pub_key | The public key of the group.
  [in] | compressed_privkey | The compressed member private key to be decompressed.
  [out] | priv_key | The member private key.

Returns
  EpidStatus

Examples:
  signmsg.c.

size_t EpidGetNumPreSigs | ( | MemberCtx const * | ctx | ) |

Gets the number of pre-computed signatures in the member's pool.

Parameters

  [in] | ctx | The member context.

Returns
  Number of remaining pre-computed signatures. Returns 0 if ctx is NULL.

See also
  EpidMemberCreate
  EpidWritePreSigs

size_t EpidGetSigSize | ( | SigRl const * | sig_rl | ) |

Computes the size in bytes required for a Intel(R) EPID signature.

Parameters

  [in] | sig_rl | The signature based revocation list that is used. NULL is treated as a zero length list.

Returns
  Size in bytes of an Intel(R) EPID signature including proofs for each entry in the signature based revocation list.

See also
  SigRl

Examples:
  signmsg.c.

bool EpidIsPrivKeyInGroup | ( | GroupPubKey const * | pub_key,
|  | PrivKey const * | priv_key
| ) |  |

Tests if a member private key is valid without checking revocation.

Used to check that a member private key is a valid key for a group. This is useful as a cross check when creating a new member private key as part of the join process

Parameters

  [in] | pub_key | The public key of the group.
  [in] | priv_key | The private key to check.

Returns
  bool

Return values

  true | if the private key is valid for the group of the public key
  false | if the private key is not valid for the group of the public key

See also
  EpidRequestJoin

EpidStatus EpidMemberCreate | ( | GroupPubKey const * | pub_key,
|  | PrivKey const * | priv_key,
|  | MemberPrecomp const * | precomp,
|  | BitSupplier | rnd_func,
|  | void * | rnd_param,
|  | MemberCtx ** | ctx
| ) |  |

Creates a new member context.

Must be called to create the member context that is used by other "Member" APIs.

Allocates memory for the context, then initializes it.

EpidMemberDelete() must be called to safely release the member context.

Parameters

  [in] | pub_key | The group certificate.
  [in] | priv_key | The member private key.
  [in] | precomp | Optional pre-computed data. If NULL the value is computed internally and is readable using EpidMemberWritePrecomp().
  [in] | rnd_func | Random number generator.
  [in] | rnd_param | Pass through context data for rnd_func.
  [out] | ctx | Newly constructed member context.

Returns
  EpidStatus

Warning
  For security rnd_func should be a cryptographically secure random number generator.

Note
  If the result is not kEpidNoErr the content of ctx is undefined.

See also
  EpidMemberDelete
  EpidMemberWritePrecomp

Examples:
  signmsg.c.

void EpidMemberDelete | ( | MemberCtx ** | ctx | ) |

Deletes an existing member context.

Must be called to safely release a member context created using EpidMemberCreate().

De-initializes the context, frees memory used by the context, and sets the context pointer to NULL.

Parameters

  [in,out] | ctx | The member context. Can be NULL.

See also
  EpidMemberCreate

Examples:
  signmsg.c.

EpidStatus EpidMemberSetHashAlg | ( | MemberCtx * | ctx,
|  | HashAlg | hash_alg
| ) |  |

Sets the hash algorithm to be used by a member.

Parameters

  [in] | ctx | The member context.
  [in] | hash_alg | The hash algorithm to use.

Returns
  EpidStatus

Note
  If the result is not kEpidNoErr, the hash algorithm used by the member is undefined.

See also
  EpidMemberCreate
  HashAlg

Examples:
  signmsg.c.

EpidStatus EpidMemberWritePrecomp | ( | MemberCtx const * | ctx,
|  | MemberPrecomp * | precomp
| ) |  |

Serializes the pre-computed member settings.

Parameters

  [in] | ctx | The member context.
  [out] | precomp | The Serialized pre-computed member settings.

Returns
  EpidStatus

Note
  If the result is not kEpidNoErr, the content of precomp is undefined.

Examples:
  signmsg.c.

EpidStatus EpidNrProve | ( | MemberCtx const * | ctx,
|  | void const * | msg,
|  | size_t | msg_len,
|  | BasicSignature const * | sig,
|  | SigRlEntry const * | sigrl_entry,
|  | NrProof * | proof
| ) |  |

Calculates a non-revoked proof for a single signature based revocation list entry.

Used in constrained environments where, due to limited memory, it may not be possible to process through a large and potentially unbounded revocation list.

Parameters

  [in] | ctx | The member context.
  [in] | msg | The message.
  [in] | msg_len | The length of message in bytes.
  [in] | sig | The basic signature.
  [in] | sigrl_entry | The signature based revocation list entry.
  [out] | proof | The generated non-revoked proof.

Returns
  EpidStatus

Note
  This function should be used in conjunction with EpidSignBasic().
  If the result is not kEpidNoErr, the content of proof is undefined.

See also
  EpidMemberCreate
  EpidSignBasic

EpidStatus EpidRegisterBaseName | ( | MemberCtx * | ctx,
|  | void const * | basename,
|  | size_t | basename_len
| ) |  |

Registers a basename with a member.

To prevent loss of privacy, the member keeps a list of basenames (corresponding to authorized verifiers). The member signs a message with a basename only if the basename is in the member's basename list.

Warning
  The use of a name-based signature creates a platform unique pseudonymous identifier. Because it reduces the member's privacy, the user should be notified when it is used and should have control over its use.

Parameters

  [in] | ctx | The member context.
  [in] | basename | The basename.
  [in] | basename_len | Length of the basename.

Returns
  EpidStatus

Return values

  kEpidDuplicateErr | The basename was already registered.

Note
  If the result is not kEpidNoErr or kEpidDuplicateErr it is undefined if the basename is registered.

Examples:
  signmsg.c.

EpidStatus EpidRequestJoin | ( | GroupPubKey const * | pub_key,
|  | IssuerNonce const * | ni,
|  | FpElemStr const * | f,
|  | BitSupplier | rnd_func,
|  | void * | rnd_param,
|  | HashAlg | hash_alg,
|  | JoinRequest * | join_request
| ) |  |

Creates a request to join a group.

The created request is part of the interaction with an issuer needed to join a group. This interaction with the issuer is outside the scope of this API.

Parameters

  [in] | pub_key | The group certificate of group to join.
  [in] | ni | The nonce chosen by issuer as part of join protocol.
  [in] | f | A randomly selected integer in [1, p-1].
  [in] | rnd_func | Random number generator.
  [in] | rnd_param | Pass through context data for rnd_func.
  [in] | hash_alg | The hash algorithm to be used.
  [out] | join_request | The join request.

Returns
  EpidStatus

Warning
  For security rnd_func should be a cryptographically secure random number generator.

Note
  The default hash algorithm in Member is SHA-512. This is the recommended option if you do not override the hash algorithm elsewhere.
  If the result is not kEpidNoErr, the content of join_request is undefined.

See also
  HashAlg

EpidStatus EpidSign | ( | MemberCtx const * | ctx,
|  | void const * | msg,
|  | size_t | msg_len,
|  | void const * | basename,
|  | size_t | basename_len,
|  | SigRl const * | sig_rl,
|  | size_t | sig_rl_size,
|  | EpidSignature * | sig,
|  | size_t | sig_len
| ) |  |

Writes a Intel(R) EPID signature.

Parameters

  [in] | ctx | The member context.
  [in] | msg | The message to sign.
  [in] | msg_len | The length in bytes of message.
  [in] | basename | Optional basename. If basename is NULL a random basename is used. Signatures generated using random basenames are anonymous. Signatures generated using the same basename are linkable by the verifier. If a basename is provided, it must already be registered, or kEpidBadArgErr is returned.
  [in] | basename_len | The size of basename in bytes. Must be 0 basename is NULL.
  [in] | sig_rl | The signature based revocation list.
  [in] | sig_rl_size | The size in bytes of the signature based revocation list.
  [out] | sig | The generated signature
  [in] | sig_len | The size of signature in bytes. Must be equal to value returned by EpidGetSigSize().

Returns
  EpidStatus

Note
  If the result is not kEpidNoErr the content of sig is undefined.

See also
  EpidMemberCreate
  EpidMemberSetHashAlg
  EpidGetSigSize

Examples:
  signmsg.c.

EpidStatus EpidSignBasic | ( | MemberCtx const * | ctx,
|  | void const * | msg,
|  | size_t | msg_len,
|  | void const * | basename,
|  | size_t | basename_len,
|  | BasicSignature * | sig
| ) |  |

Creates a basic signature for use in constrained environment.

Used in constrained environments where, due to limited memory, it may not be possible to process through a large and potentially unbounded revocation list.

Parameters

  [in] | ctx | The member context.
  [in] | msg | The message.
  [in] | msg_len | The length of message in bytes.
  [in] | basename | Optional basename. If basename is NULL a random basename is used. Signatures generated using random basenames are anonymous. Signatures generated using the same basename are linkable by the verifier. If a basename is provided it must already be registered or kEpidBadArgErr is returned.
  [in] | basename_len | The size of basename in bytes. Must be 0 basename is NULL.
  [out] | sig | The generated basic signature

Returns
  EpidStatus

Note
  This function should be used in conjunction with EpidNrProve()
  If the result is not kEpidNoErr the content of sig, is undefined.

See also
  EpidMemberCreate
  EpidNrProve

EpidStatus EpidWritePreSigs | ( | MemberCtx * | ctx,
|  | PreComputedSignature * | presigs,
|  | size_t | number_presigs
| ) |  |

Serializes pre-computed signatures from the member's pool.

Removes requested number of pre-computed signatures from member's pool and stores them in presigs array. Use EpidAddPreSigs to add pre-computed signatures to the pool.

Parameters

  [in] | ctx | The member context.
  [out] | presigs | An existing buffer of pre-computed signatures.
  [in] | number_presigs | Number of pre-computed signatures to read. Number_presigs must not be greater than the value returned by EpidGetNumPreSigs.

Returns
  EpidStatus

Note
  If the result is not kEpidNoErr the state of the pre-computed signature pool, and of presigs, is undefined.

See also
  EpidMemberCreate
  EpidGetNumPreSigs
  EpidAddPreSigs