"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/auth/SecureRemotePassword/misc/test_srp.cpp" between
Firebird- and Firebird-

About: Firebird is a relational database offering many ANSI SQL standard features.

test_srp.cpp  (Firebird-  (Firebird-
#include "../auth/SecureRemotePassword/srp.h" #include "../auth/SecureRemotePassword/srp.h"
using namespace Auth; using namespace Auth;
int main(int argc, char** argv) template<class SHA>void runTest(int argc, char** argv)
{ {
Firebird::string salt; Firebird::string salt;
#if SRP_DEBUG > 1 #if SRP_DEBUG > 1
BigInteger s("02E268803000000079A478A700000002D1A6979000000026E1601C00000 0054F"); Firebird::BigInteger s("02E268803000000079A478A700000002D1A6979000000026E 1601C000000054F");
#else #else
BigInteger s; Firebird::BigInteger s;
s.random(128); s.random(128);
#endif #endif
s.getText(salt); s.getText(salt);
RemotePassword* server = FB_NEW RemotePassword(); RemotePassword* server = FB_NEW RemotePasswordImpl<SHA>();
RemotePassword* client = FB_NEW RemotePassword(); RemotePassword* client = FB_NEW RemotePasswordImpl<SHA>();
const char* account = "SYSDBA"; const char* account = "SYSDBA";
const char* password = "masterkey"; const char* password = "masterkey";
Firebird::UCharBuffer verifier; Firebird::UCharBuffer verifier;
dumpIt("salt", salt); dumpIt("salt", salt);
#if SRP_DEBUG > 0 #if SRP_DEBUG > 0
fprintf(stderr, "%s %s\n", account, password); fprintf(stderr, "%s %s\n", account, password);
#endif #endif
server->computeVerifier(account, salt, password).getBytes(verifier); server->computeVerifier(account, salt, password).getBytes(verifier);
skipping to change at line 40 skipping to change at line 40
Firebird::string clientPubKey, serverPubKey; Firebird::string clientPubKey, serverPubKey;
client->genClientKey(clientPubKey); client->genClientKey(clientPubKey);
fprintf(stderr, "C Pub %d\n", clientPubKey.length()); fprintf(stderr, "C Pub %d\n", clientPubKey.length());
server->genServerKey(serverPubKey, verifier); server->genServerKey(serverPubKey, verifier);
fprintf(stderr, "S Pub %d\n", serverPubKey.length()); fprintf(stderr, "S Pub %d\n", serverPubKey.length());
Firebird::UCharBuffer key1, key2; Firebird::UCharBuffer key1, key2;
client->clientSessionKey(key1, account, salt.c_str(), argc > 1 ? argv[1] : password, serverPubKey.c_str()); client->clientSessionKey(key1, account, salt.c_str(), argc > 1 ? argv[1] : password, serverPubKey.c_str());
server->serverSessionKey(key2, clientPubKey.c_str(), verifier); server->serverSessionKey(key2, clientPubKey.c_str(), verifier);
BigInteger cProof = client->clientProof(account, salt.c_str(), key1); Firebird::BigInteger cProof = client->clientProof(account, salt.c_str(),
BigInteger sProof = server->clientProof(account, salt.c_str(), key2); key1);
Firebird::BigInteger sProof = server->clientProof(account, salt.c_str(),
printf("Proof length = %d\n",cProof.length());
printf("%s\n", cProof == sProof ? "OK" : "differ"); printf("%s\n", cProof == sProof ? "OK" : "differ");
int main(int argc, char** argv)
} }
 End of changes. 7 change blocks. 
7 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)