|
reSIProcate/stack
9694
|
Implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx. More...
#include <BasicNonceHelper.hxx>


Public Member Functions | |
| BasicNonceHelper () | |
| BasicNonceHelper implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx. | |
| virtual | ~BasicNonceHelper () |
| void | setPrivateKey (const Data &privateKey) |
| Data | makeNonce (const SipMessage &request, const Data ×tamp) |
| Nonce | parseNonce (const Data &nonce) |
Private Attributes | |
| Data | privateKey |
Implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx.
To operate a farm/cluster of UASs/proxies, you must:
To operate with SER, use the SERNonceHelper instead, as that generates the nonce string the same way as SER. You must also observe the same conditions above regarding clock and key synchronization.
Definition at line 25 of file BasicNonceHelper.hxx.
| BasicNonceHelper::BasicNonceHelper | ( | ) |
BasicNonceHelper implements the makeNonce function in the same way as the original implementation of makeNonce within Helper.cxx.
To operate a farm/cluster of UASs/proxies, you must: a) make sure the clocks are sychronized (using ntpd for instance) b) use the same privateKey value on every instance of the application
To operate with SER, use the SERNonceHelper instead, as that generates the nonce string the same way as SER. You must also observe the same conditions above regarding clock and key synchronization.
Definition at line 25 of file BasicNonceHelper.cxx.
References resip::Random::getRandomHex(), and privateKey.
{
//privateKey = Data("asdfklsadflkj");
privateKey = Random::getRandomHex(24);
}

| BasicNonceHelper::~BasicNonceHelper | ( | ) | [virtual] |
Definition at line 31 of file BasicNonceHelper.cxx.
{
}
| Data BasicNonceHelper::makeNonce | ( | const SipMessage & | request, |
| const Data & | timestamp | ||
| ) | [virtual] |
Implements resip::NonceHelper.
Definition at line 42 of file BasicNonceHelper.cxx.
References resip::Symbols::COLON, resip::SipMessage::header(), resip::Data::md5(), resip::Data::Preallocate, privateKey, resip::RequestLine::uri(), and resip::Uri::user().
{
Data nonce(100, Data::Preallocate);
nonce += timestamp;
nonce += Symbols::COLON;
Data noncePrivate(100, Data::Preallocate);
noncePrivate += timestamp;
noncePrivate += Symbols::COLON;
// !jf! don't include the Call-Id since it might not be the same.
// noncePrivate += request.header(h_CallId).value();
noncePrivate += request.header(h_From).uri().user();
noncePrivate += privateKey;
nonce += noncePrivate.md5();
return nonce;
}

| NonceHelper::Nonce BasicNonceHelper::parseNonce | ( | const Data & | nonce | ) | [virtual] |
Implements resip::NonceHelper.
Definition at line 59 of file BasicNonceHelper.cxx.
References resip::Symbols::COLON, resip::Data::convertUInt64(), resip::Data::data(), DebugLog, and resip::Data::size().
{
ParseBuffer pb(nonce.data(), nonce.size());
if (!pb.eof() && !isdigit(*pb.position()))
{
DebugLog(<< "Invalid nonce; expected timestamp.");
return BasicNonceHelper::Nonce(0);
}
const char* anchor = pb.position();
pb.skipToChar(Symbols::COLON[0]);
if (pb.eof())
{
DebugLog(<< "Invalid nonce; expected timestamp terminator.");
return BasicNonceHelper::Nonce(0);
}
Data creationTime;
pb.data(creationTime, anchor);
return BasicNonceHelper::Nonce(creationTime.convertUInt64());
}

| void BasicNonceHelper::setPrivateKey | ( | const Data & | privateKey | ) |
Definition at line 36 of file BasicNonceHelper.cxx.
References privateKey.
{
this->privateKey = pprivateKey;
}
Data resip::BasicNonceHelper::privateKey [private] |
Definition at line 28 of file BasicNonceHelper.hxx.
Referenced by BasicNonceHelper(), makeNonce(), and setPrivateKey().
1.7.5.1