mirror of https://github.com/sipwise/sems.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
#include "fct.h"
|
|
|
|
#include "log.h"
|
|
|
|
#include "AmSipHeaders.h"
|
|
#include "AmSipMsg.h"
|
|
#include "AmUtils.h"
|
|
#include "plug-in/uac_auth/UACAuth.h"
|
|
|
|
FCTMF_SUITE_BGN(test_auth) {
|
|
|
|
FCT_TEST_BGN(nonce_gen) {
|
|
|
|
string nonce = UACAuth::calcNonce();
|
|
// DBG("nonce '%s'\n", nonce.c_str());
|
|
fct_chk( UACAuth::checkNonce(nonce));
|
|
} FCT_TEST_END();
|
|
|
|
FCT_TEST_BGN(nonce_wrong_secret) {
|
|
UACAuth::setServerSecret("secret1");
|
|
string nonce = UACAuth::calcNonce();
|
|
UACAuth::setServerSecret("secret2");
|
|
fct_chk( !UACAuth::checkNonce(nonce));
|
|
} FCT_TEST_END();
|
|
|
|
FCT_TEST_BGN(nonce_wrong_nonce) {
|
|
string nonce = UACAuth::calcNonce();
|
|
nonce[0]=0;
|
|
nonce[1]=0;
|
|
fct_chk( !UACAuth::checkNonce(nonce));
|
|
} FCT_TEST_END();
|
|
|
|
FCT_TEST_BGN(nonce_wrong_nonce) {
|
|
string nonce = UACAuth::calcNonce();
|
|
nonce+="hallo";
|
|
fct_chk( !UACAuth::checkNonce(nonce));
|
|
} FCT_TEST_END();
|
|
|
|
FCT_TEST_BGN(nonce_wrong_nonce2) {
|
|
string nonce = UACAuth::calcNonce();
|
|
nonce[nonce.size()-1]=nonce[nonce.size()-2];
|
|
fct_chk( !UACAuth::checkNonce(nonce));
|
|
} FCT_TEST_END();
|
|
|
|
} FCTMF_SUITE_END();
|