My Project
|
Functions | |
int | wc_SrpInit (Srp *srp, SrpType type, SrpSide side) |
Initializes the Srp struct for usage. More... | |
void | wc_SrpTerm (Srp *srp) |
Releases the Srp struct resources after usage. More... | |
int | wc_SrpSetUsername (Srp *srp, const byte *username, word32 size) |
Sets the username. This function MUST be called after wc_SrpInit. More... | |
int | wc_SrpSetParams (Srp *srp, const byte *N, word32 nSz, const byte *g, word32 gSz, const byte *salt, word32 saltSz) |
Sets the srp parameters based on the username.. Must be called after wc_SrpSetUsername. More... | |
int | wc_SrpSetPassword (Srp *srp, const byte *password, word32 size) |
Sets the password. Setting the password does not persists the clear password data in the srp structure. The client calculates x = H(salt + H(user:pswd)) and stores it in the auth field. This function MUST be called after wc_SrpSetParams and is CLIENT SIDE ONLY. More... | |
int | wc_SrpSetVerifier (Srp *srp, const byte *verifier, word32 size) |
Sets the verifier. This function MUST be called after wc_SrpSetParams and is SERVER SIDE ONLY. More... | |
int | wc_SrpGetVerifier (Srp *srp, byte *verifier, word32 *size) |
Gets the verifier. The client calculates the verifier with v = g ^ x % N. This function MAY be called after wc_SrpSetPassword and is CLIENT SIDE ONLY. More... | |
int | wc_SrpSetPrivate (Srp *srp, const byte *priv, word32 size) |
Sets the private ephemeral value. The private ephemeral value is known as: a at the client side. a = random() b at the server side. b = random() This function is handy for unit test cases or if the developer wants to use an external random source to set the ephemeral value. This function MAY be called before wc_SrpGetPublic. More... | |
int | wc_SrpGetPublic (Srp *srp, byte *pub, word32 *size) |
Gets the public ephemeral value. The public ephemeral value is known as: A at the client side. A = g ^ a % N B at the server side. B = (k * v + (g ˆ b % N)) % N This function MUST be called after wc_SrpSetPassword or wc_SrpSetVerifier. The function wc_SrpSetPrivate may be called before wc_SrpGetPublic. More... | |
int | wc_SrpComputeKey (Srp *srp, byte *clientPubKey, word32 clientPubKeySz, byte *serverPubKey, word32 serverPubKeySz) |
Computes the session key. The key can be accessed at srp->key after success. More... | |
int | wc_SrpGetProof (Srp *srp, byte *proof, word32 *size) |
Gets the proof. This function MUST be called after wc_SrpComputeKey. More... | |
int | wc_SrpVerifyPeersProof (Srp *srp, byte *proof, word32 size) |
Verifies the peers proof. This function MUST be called before wc_SrpGetSessionKey. More... | |
int wc_SrpComputeKey | ( | Srp * | srp, |
byte * | clientPubKey, | ||
word32 | clientPubKeySz, | ||
byte * | serverPubKey, | ||
word32 | serverPubKeySz | ||
) |
Computes the session key. The key can be accessed at srp->key after success.
srp | the Srp structure. |
clientPubKey | the client's public ephemeral value. |
clientPubKeySz | the client's public ephemeral value size. |
serverPubKey | the server's public ephemeral value. |
serverPubKeySz | the server's public ephemeral value size. |
Example
int wc_SrpGetProof | ( | Srp * | srp, |
byte * | proof, | ||
word32 * | size | ||
) |
Gets the proof. This function MUST be called after wc_SrpComputeKey.
srp | the Srp structure. |
proof | the peers proof. |
size | the proof size in bytes. |
Example
int wc_SrpGetPublic | ( | Srp * | srp, |
byte * | pub, | ||
word32 * | size | ||
) |
Gets the public ephemeral value. The public ephemeral value is known as: A at the client side. A = g ^ a % N B at the server side. B = (k * v + (g ˆ b % N)) % N This function MUST be called after wc_SrpSetPassword or wc_SrpSetVerifier. The function wc_SrpSetPrivate may be called before wc_SrpGetPublic.
srp | the Srp structure. |
pub | the buffer to write the public ephemeral value. |
size | the the buffer size in bytes. Will be updated with the ephemeral value size. |
Example
int wc_SrpGetVerifier | ( | Srp * | srp, |
byte * | verifier, | ||
word32 * | size | ||
) |
Gets the verifier. The client calculates the verifier with v = g ^ x % N. This function MAY be called after wc_SrpSetPassword and is CLIENT SIDE ONLY.
srp | The Srp structure. |
verifier | The buffer to write the verifier. |
size | Buffer size in bytes. Updated with the verifier size. |
Example
int wc_SrpInit | ( | Srp * | srp, |
SrpType | type, | ||
SrpSide | side | ||
) |
Initializes the Srp struct for usage.
srp | the Srp structure to be initialized. |
type | the hash type to be used. |
side | the side of the communication. |
Example
int wc_SrpSetParams | ( | Srp * | srp, |
const byte * | N, | ||
word32 | nSz, | ||
const byte * | g, | ||
word32 | gSz, | ||
const byte * | salt, | ||
word32 | saltSz | ||
) |
Sets the srp parameters based on the username.. Must be called after wc_SrpSetUsername.
srp | the Srp structure. |
N | the Modulus. N = 2q+1, [q, N] are primes. |
nSz | the N size in bytes. |
g | the Generator modulo N. |
gSz | the g size in bytes |
salt | a small random salt. Specific for each username. |
saltSz | the salt size in bytes |
Example
int wc_SrpSetPassword | ( | Srp * | srp, |
const byte * | password, | ||
word32 | size | ||
) |
Sets the password. Setting the password does not persists the clear password data in the srp structure. The client calculates x = H(salt + H(user:pswd)) and stores it in the auth field. This function MUST be called after wc_SrpSetParams and is CLIENT SIDE ONLY.
srp | The Srp structure. |
password | The buffer containing the password. |
size | The size of the password in bytes. |
Example
int wc_SrpSetPrivate | ( | Srp * | srp, |
const byte * | priv, | ||
word32 | size | ||
) |
Sets the private ephemeral value. The private ephemeral value is known as: a at the client side. a = random() b at the server side. b = random() This function is handy for unit test cases or if the developer wants to use an external random source to set the ephemeral value. This function MAY be called before wc_SrpGetPublic.
srp | the Srp structure. |
priv | the ephemeral value. |
size | the private size in bytes. |
Example
int wc_SrpSetUsername | ( | Srp * | srp, |
const byte * | username, | ||
word32 | size | ||
) |
Sets the username. This function MUST be called after wc_SrpInit.
srp | the Srp structure. |
username | the buffer containing the username. |
size | the username size in bytes |
Example
int wc_SrpSetVerifier | ( | Srp * | srp, |
const byte * | verifier, | ||
word32 | size | ||
) |
Sets the verifier. This function MUST be called after wc_SrpSetParams and is SERVER SIDE ONLY.
srp | The Srp structure. |
verifier | The structure containing the verifier. |
size | The verifier size in bytes. |
Example
void wc_SrpTerm | ( | Srp * | srp | ) |
Releases the Srp struct resources after usage.
srp | Pointer to the Srp structure to be terminated. |
Example
int wc_SrpVerifyPeersProof | ( | Srp * | srp, |
byte * | proof, | ||
word32 | size | ||
) |
Verifies the peers proof. This function MUST be called before wc_SrpGetSessionKey.
srp | the Srp structure. |
proof | the peers proof. |
size | the proof size in bytes. |
Example