IBR-DTN
1.0.0
|
#include <KeyExchangeSession.h>
Classes | |
class | SessionState |
Public Member Functions | |
KeyExchangeSession (int protocol, const dtn::data::EID &peer, unsigned int uniqueId, SessionState *state=NULL) | |
virtual | ~KeyExchangeSession () |
dtn::data::Timestamp | getExpiration () const |
void | touch () |
const dtn::data::EID & | getPeer () const |
int | getProtocol () const |
unsigned int | getUniqueId () const |
const std::string & | getSessionKey () const |
dtn::security::SecurityKey | getKey (const dtn::security::SecurityKey::KeyType type=dtn::security::SecurityKey::KEY_UNSPEC) const throw (SecurityKey::KeyNotFoundException) |
void | putKey (const std::string &data, const dtn::security::SecurityKey::KeyType type, const dtn::security::SecurityKey::TrustLevel trust) const |
void | clearKeys () const |
template<class T > | |
T & | getState () |
Static Public Member Functions | |
static std::string | getSessionKey (const dtn::data::EID &peer, unsigned int uniqueId) |
Definition at line 37 of file KeyExchangeSession.h.
dtn::security::KeyExchangeSession::KeyExchangeSession | ( | int | protocol, |
const dtn::data::EID & | peer, | ||
unsigned int | uniqueId, | ||
SessionState * | state = NULL |
||
) |
Definition at line 38 of file KeyExchangeSession.cpp.
References dtn::utils::Clock::getMonotonicTimestamp(), and getSessionKey().
|
virtual |
Definition at line 48 of file KeyExchangeSession.cpp.
References clearKeys().
void dtn::security::KeyExchangeSession::clearKeys | ( | ) | const |
Clear all stored key in the session
Definition at line 128 of file KeyExchangeSession.cpp.
References dtn::security::SecurityKeyManager::getInstance(), getKey(), dtn::security::SecurityKey::KEY_PRIVATE, dtn::security::SecurityKey::KEY_PUBLIC, dtn::security::SecurityKey::KEY_SHARED, and dtn::security::SecurityKeyManager::remove().
Referenced by ~KeyExchangeSession().
dtn::data::Timestamp dtn::security::KeyExchangeSession::getExpiration | ( | ) | const |
Returns the expiration time of this session
Definition at line 57 of file KeyExchangeSession.cpp.
dtn::security::SecurityKey dtn::security::KeyExchangeSession::getKey | ( | const dtn::security::SecurityKey::KeyType | type = dtn::security::SecurityKey::KEY_UNSPEC | ) | const |
throw | ( | SecurityKey::KeyNotFoundException | |||
) |
Return the key stored within this session
Definition at line 97 of file KeyExchangeSession.cpp.
References dtn::security::SecurityKeyManager::get(), and dtn::security::SecurityKeyManager::getInstance().
Referenced by clearKeys(), and dtn::security::KeyExchanger::finish().
const dtn::data::EID & dtn::security::KeyExchangeSession::getPeer | ( | ) | const |
Returns the peer of the exchange session
Definition at line 77 of file KeyExchangeSession.cpp.
Referenced by dtn::security::QRCodeProtocol::begin(), dtn::security::JPAKEProtocol::begin(), dtn::security::KeyExchanger::error(), dtn::security::KeyExchanger::finish(), dtn::security::HashProtocol::step(), dtn::security::JPAKEProtocol::step(), and dtn::security::KeyExchanger::submit().
int dtn::security::KeyExchangeSession::getProtocol | ( | ) | const |
Returns the protocol ID of this session
Definition at line 82 of file KeyExchangeSession.cpp.
Referenced by putKey().
const std::string & dtn::security::KeyExchangeSession::getSessionKey | ( | ) | const |
Returns the session key
Definition at line 92 of file KeyExchangeSession.cpp.
Referenced by KeyExchangeSession().
|
static |
Generates a session key based on the peer and the unique ID
Definition at line 68 of file KeyExchangeSession.cpp.
References dtn::data::EID::getString().
|
inline |
Returns the session state or throws an exception if the state does not match the requested approach
Definition at line 106 of file KeyExchangeSession.h.
Referenced by dtn::security::HashProtocol::begin(), dtn::security::JPAKEProtocol::begin(), dtn::security::DHProtocol::begin(), dtn::security::HashProtocol::step(), dtn::security::JPAKEProtocol::step(), and dtn::security::DHProtocol::step().
unsigned int dtn::security::KeyExchangeSession::getUniqueId | ( | ) | const |
Returns the unique ID of the session
Definition at line 87 of file KeyExchangeSession.cpp.
Referenced by dtn::security::KeyExchanger::finish(), putKey(), and dtn::security::KeyExchangeData::setSession().
void dtn::security::KeyExchangeSession::putKey | ( | const std::string & | data, |
const dtn::security::SecurityKey::KeyType | type, | ||
const dtn::security::SecurityKey::TrustLevel | trust | ||
) | const |
Stores a key in the session
Definition at line 105 of file KeyExchangeSession.cpp.
References dtn::security::SecurityKey::flags, dtn::security::SecurityKeyManager::getInstance(), getProtocol(), getUniqueId(), dtn::security::SecurityKey::reference, dtn::security::SecurityKeyManager::store(), dtn::security::SecurityKey::trustlevel, and dtn::security::SecurityKey::type.
Referenced by dtn::security::NFCProtocol::begin(), dtn::security::QRCodeProtocol::begin(), dtn::security::NoneProtocol::step(), dtn::security::HashProtocol::step(), dtn::security::JPAKEProtocol::step(), and dtn::security::DHProtocol::step().
void dtn::security::KeyExchangeSession::touch | ( | ) |
Prolong the lifetime of this session
Definition at line 62 of file KeyExchangeSession.cpp.
References dtn::utils::Clock::getMonotonicTimestamp().
Referenced by dtn::security::KeyExchanger::submit().