MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / clientSessionKey

Method clientSessionKey

src/auth/SecureRemotePassword/srp.cpp:135–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void RemotePassword::clientSessionKey(UCharBuffer& sessionKey, const char* account,
136 const char* salt, const char* password,
137 const char* serverPubKey)
138{
139 serverPublicKey = BigInteger(serverPubKey);
140 computeScramble();
141 dumpIt("scramble", scramble);
142 dumpIt("password", password);
143 BigInteger x = getUserHash(account, salt, password); // x
144 dumpIt("x", x);
145 BigInteger gx = group->generator.modPow(x, group->prime); // g^x
146 BigInteger kgx = (group->k * gx) % group->prime; // kg^x
147 dumpIt("kgx", kgx);
148 BigInteger diff = (serverPublicKey - kgx) % group->prime; // B - kg^x
149 BigInteger ux = (scramble * x) % group->prime; // ux
150 BigInteger aux = (privateKey + ux) % group->prime; // A + ux
151 dumpIt("clientPrivateKey", privateKey);
152 dumpIt("aux", aux);
153 BigInteger sessionSecret = diff.modPow(aux, group->prime); // (B - kg^x) ^ (a + ux)
154 dumpIt("sessionSecret", sessionSecret);
155
156 hash.reset();
157 hash.processStrippedInt(sessionSecret);
158 hash.getHash(sessionKey);
159}
160
161void RemotePassword::serverSessionKey(UCharBuffer& sessionKey, const char* clientPubKey,
162 const UCharBuffer& verifier)

Callers 2

authenticateMethod · 0.80
runTestFunction · 0.80

Calls 6

BigIntegerClass · 0.85
modPowMethod · 0.80
processStrippedIntMethod · 0.80
dumpItFunction · 0.70
resetMethod · 0.45
getHashMethod · 0.45

Tested by 1

runTestFunction · 0.64