My Project
|
Functions | |
int | wc_InitDhKey (DhKey *key) |
This function initializes a Diffie-Hellman key for use in negotiating a secure secret key with the Diffie-Hellman exchange protocol. More... | |
void | wc_FreeDhKey (DhKey *key) |
This function frees a Diffie-Hellman key after it has been used to negotiate a secure secret key with the Diffie-Hellman exchange protocol. More... | |
int | wc_DhGenerateKeyPair (DhKey *key, WC_RNG *rng, byte *priv, word32 *privSz, byte *pub, word32 *pubSz) |
This function generates a public/private key pair based on the Diffie-Hellman public parameters, storing the private key in priv and the public key in pub. It takes an initialized Diffie-Hellman key and an initialized rng structure. More... | |
int | wc_DhAgree (DhKey *key, byte *agree, word32 *agreeSz, const byte *priv, word32 privSz, const byte *otherPub, word32 pubSz) |
This function generates an agreed upon secret key based on a local private key and a received public key. If completed on both sides of an exchange, this function generates an agreed upon secret key for symmetric communication. On successfully generating a shared secret key, the size of the secret key written will be stored in agreeSz. More... | |
int | wc_DhKeyDecode (const byte *input, word32 *inOutIdx, DhKey *key, word32) |
This function decodes a Diffie-Hellman key from the given input buffer containing the key in DER format. It stores the result in the DhKey structure. More... | |
int | wc_DhSetKey (DhKey *key, const byte *p, word32 pSz, const byte *g, word32 gSz) |
This function sets the key for a DhKey structure using the input private key parameters. Unlike wc_DhKeyDecode, this function does not require that the input key be formatted in DER format, and instead simply accepts the parsed input parameters p (prime) and g (base). More... | |
int | wc_DhParamsLoad (const byte *input, word32 inSz, byte *p, word32 *pInOutSz, byte *g, word32 *gInOutSz) |
This function loads the Diffie-Hellman parameters, p (prime) and g (base) out of the given input buffer, DER formatted. More... | |
const DhParams * | wc_Dh_ffdhe2048_Get (void) |
This function returns ... and requires that HAVE_FFDHE_2048 be defined. More... | |
const DhParams * | wc_Dh_ffdhe3072_Get (void) |
This function returns ... and requires that HAVE_FFDHE_3072 be defined. More... | |
const DhParams * | wc_Dh_ffdhe4096_Get (void) |
This function returns ... and requires that HAVE_FFDHE_4096 be defined. More... | |
const DhParams * | wc_Dh_ffdhe6144_Get (void) |
This function returns ... and requires that HAVE_FFDHE_6144 be defined. More... | |
const DhParams * | wc_Dh_ffdhe8192_Get (void) |
This function returns ... and requires that HAVE_FFDHE_8192 be defined. More... | |
int | wc_DhCheckKeyPair (DhKey *key, const byte *pub, word32 pubSz, const byte *priv, word32 privSz) |
Checks DH keys for pair-wise consistency per process in SP 800-56Ar3, section 5.6.2.1.4, method (b) for FFC. More... | |
int | wc_DhCheckPrivKey (DhKey *key, const byte *priv, word32 pubSz) |
Check DH private key for invalid numbers. More... | |
int | wc_DhCheckPrivKey_ex (DhKey *key, const byte *priv, word32 pubSz, const byte *prime, word32 primeSz) |
int | wc_DhCheckPubKey (DhKey *key, const byte *pub, word32 pubSz) |
int | wc_DhCheckPubKey_ex (DhKey *key, const byte *pub, word32 pubSz, const byte *prime, word32 primeSz) |
int | wc_DhExportParamsRaw (DhKey *dh, byte *p, word32 *pSz, byte *q, word32 *qSz, byte *g, word32 *gSz) |
int | wc_DhGenerateParams (WC_RNG *rng, int modSz, DhKey *dh) |
int | wc_DhSetCheckKey (DhKey *key, const byte *p, word32 pSz, const byte *g, word32 gSz, const byte *q, word32 qSz, int trusted, WC_RNG *rng) |
int | wc_DhSetKey_ex (DhKey *key, const byte *p, word32 pSz, const byte *g, word32 gSz, const byte *q, word32 qSz) |
const DhParams* wc_Dh_ffdhe2048_Get | ( | void | ) |
This function returns ... and requires that HAVE_FFDHE_2048 be defined.
const DhParams* wc_Dh_ffdhe3072_Get | ( | void | ) |
This function returns ... and requires that HAVE_FFDHE_3072 be defined.
const DhParams* wc_Dh_ffdhe4096_Get | ( | void | ) |
This function returns ... and requires that HAVE_FFDHE_4096 be defined.
const DhParams* wc_Dh_ffdhe6144_Get | ( | void | ) |
This function returns ... and requires that HAVE_FFDHE_6144 be defined.
const DhParams* wc_Dh_ffdhe8192_Get | ( | void | ) |
This function returns ... and requires that HAVE_FFDHE_8192 be defined.
int wc_DhAgree | ( | DhKey * | key, |
byte * | agree, | ||
word32 * | agreeSz, | ||
const byte * | priv, | ||
word32 | privSz, | ||
const byte * | otherPub, | ||
word32 | pubSz | ||
) |
This function generates an agreed upon secret key based on a local private key and a received public key. If completed on both sides of an exchange, this function generates an agreed upon secret key for symmetric communication. On successfully generating a shared secret key, the size of the secret key written will be stored in agreeSz.
key | pointer to the DhKey structure to use to compute the shared key |
agree | pointer to the buffer in which to store the secret key |
agreeSz | will hold the size of the secret key after successful generation |
priv | pointer to the buffer containing the local secret key |
privSz | size of the local secret key |
otherPub | pointer to a buffer containing the received public key |
pubSz | size of the received public key |
Example
int wc_DhCheckKeyPair | ( | DhKey * | key, |
const byte * | pub, | ||
word32 | pubSz, | ||
const byte * | priv, | ||
word32 | privSz | ||
) |
Checks DH keys for pair-wise consistency per process in SP 800-56Ar3, section 5.6.2.1.4, method (b) for FFC.
int wc_DhCheckPrivKey | ( | DhKey * | key, |
const byte * | priv, | ||
word32 | pubSz | ||
) |
Check DH private key for invalid numbers.
int wc_DhCheckPrivKey_ex | ( | DhKey * | key, |
const byte * | priv, | ||
word32 | pubSz, | ||
const byte * | prime, | ||
word32 | primeSz | ||
) |
int wc_DhCheckPubKey | ( | DhKey * | key, |
const byte * | pub, | ||
word32 | pubSz | ||
) |
int wc_DhCheckPubKey_ex | ( | DhKey * | key, |
const byte * | pub, | ||
word32 | pubSz, | ||
const byte * | prime, | ||
word32 | primeSz | ||
) |
int wc_DhExportParamsRaw | ( | DhKey * | dh, |
byte * | p, | ||
word32 * | pSz, | ||
byte * | q, | ||
word32 * | qSz, | ||
byte * | g, | ||
word32 * | gSz | ||
) |
int wc_DhGenerateKeyPair | ( | DhKey * | key, |
WC_RNG * | rng, | ||
byte * | priv, | ||
word32 * | privSz, | ||
byte * | pub, | ||
word32 * | pubSz | ||
) |
This function generates a public/private key pair based on the Diffie-Hellman public parameters, storing the private key in priv and the public key in pub. It takes an initialized Diffie-Hellman key and an initialized rng structure.
key | pointer to the DhKey structure from which to generate the key pair |
rng | pointer to an initialized random number generator (rng) with which to generate the keys |
priv | pointer to a buffer in which to store the private key |
privSz | will store the size of the private key written to priv |
pub | pointer to a buffer in which to store the public key |
pubSz | will store the size of the private key written to pub |
Example
int wc_DhGenerateParams | ( | WC_RNG * | rng, |
int | modSz, | ||
DhKey * | dh | ||
) |
int wc_DhKeyDecode | ( | const byte * | input, |
word32 * | inOutIdx, | ||
DhKey * | key, | ||
word32 | |||
) |
This function decodes a Diffie-Hellman key from the given input buffer containing the key in DER format. It stores the result in the DhKey structure.
input | pointer to the buffer containing the DER formatted Diffie-Hellman key |
inOutIdx | pointer to an integer in which to store the index parsed to while decoding the key |
key | pointer to the DhKey structure to initialize with the input key |
inSz | length of the input buffer. Gives the max length that may be read |
Example
int wc_DhParamsLoad | ( | const byte * | input, |
word32 | inSz, | ||
byte * | p, | ||
word32 * | pInOutSz, | ||
byte * | g, | ||
word32 * | gInOutSz | ||
) |
This function loads the Diffie-Hellman parameters, p (prime) and g (base) out of the given input buffer, DER formatted.
input | pointer to a buffer containing a DER formatted Diffie-Hellman certificate to parse |
inSz | size of the input buffer |
p | pointer to a buffer in which to store the parsed prime |
pInOutSz | pointer to a word32 object containing the available size in the p buffer. Will be overwritten with the number of bytes written to the buffer after completing the function call |
g | pointer to a buffer in which to store the parsed base |
gInOutSz | pointer to a word32 object containing the available size in the g buffer. Will be overwritten with the number of bytes written to the buffer after completing the function call |
Example
int wc_DhSetCheckKey | ( | DhKey * | key, |
const byte * | p, | ||
word32 | pSz, | ||
const byte * | g, | ||
word32 | gSz, | ||
const byte * | q, | ||
word32 | qSz, | ||
int | trusted, | ||
WC_RNG * | rng | ||
) |
int wc_DhSetKey | ( | DhKey * | key, |
const byte * | p, | ||
word32 | pSz, | ||
const byte * | g, | ||
word32 | gSz | ||
) |
This function sets the key for a DhKey structure using the input private key parameters. Unlike wc_DhKeyDecode, this function does not require that the input key be formatted in DER format, and instead simply accepts the parsed input parameters p (prime) and g (base).
key | pointer to the DhKey structure on which to set the key |
p | pointer to the buffer containing the prime for use with the key |
pSz | length of the input prime |
g | pointer to the buffer containing the base for use with the key |
gSz | length of the input base |
Example
int wc_DhSetKey_ex | ( | DhKey * | key, |
const byte * | p, | ||
word32 | pSz, | ||
const byte * | g, | ||
word32 | gSz, | ||
const byte * | q, | ||
word32 | qSz | ||
) |
int wc_FreeDhKey | ( | DhKey * | key | ) |
This function frees a Diffie-Hellman key after it has been used to negotiate a secure secret key with the Diffie-Hellman exchange protocol.
key | pointer to the DhKey structure to free |
Example
int wc_InitDhKey | ( | DhKey * | key | ) |
This function initializes a Diffie-Hellman key for use in negotiating a secure secret key with the Diffie-Hellman exchange protocol.
key | pointer to the DhKey structure to initialize for use with secure key exchanges |
Example