git-svn-id: svn://db.shs.com.ru/pip@608 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -34,27 +34,54 @@ public:
|
||||
enum Role {Client, Server};
|
||||
enum State {NotConnected, AuthProbe, PassRequest, AuthReply, KeyExchange, Connected};
|
||||
|
||||
//! Create PIAuth with your digital sign
|
||||
PIAuth(const PIByteArray & sign);
|
||||
|
||||
void setInfoData(const PIByteArray & info_) {info = info_;}
|
||||
//! Set server info data for client authorize event
|
||||
void setInfoData(const PIByteArray & info) {server_info = info;}
|
||||
|
||||
//! Set list of trusted clients/servers public digital sign keys
|
||||
void setAuthorizedPublicKeys(const PIVector<PIByteArray> & pkeys) {auth_pkeys = pkeys;}
|
||||
|
||||
//! Get list of trusted clients/servers public digital sign keys
|
||||
PIVector<PIByteArray> getAuthorizedPublicKeys() {return auth_pkeys;}
|
||||
|
||||
//! Get your digital sign public key
|
||||
PIByteArray getSignPublicKey() {return sign_pk;}
|
||||
|
||||
|
||||
//! Stop authorization
|
||||
void stop();
|
||||
|
||||
//! Start authorization as client
|
||||
void startClient();
|
||||
|
||||
//! Start authorization as server, return first server message for client
|
||||
PIByteArray startServer();
|
||||
|
||||
//! Process reseived message both for client and server, return current state and new message writed in "ba"
|
||||
State receive(PIByteArray & ba);
|
||||
|
||||
//! Get session secret key, return key only when Connected state
|
||||
PIByteArray getSecretKey();
|
||||
|
||||
|
||||
//! Generate digital sign from seed
|
||||
static PIByteArray generateSign(const PIByteArray & seed);
|
||||
|
||||
|
||||
//! Disconneted event
|
||||
EVENT(disconnected)
|
||||
|
||||
//! Conneted event
|
||||
EVENT(connected)
|
||||
EVENT2(authorize, PIByteArray, data, bool *, ok)
|
||||
|
||||
//! Client event for authorize new server
|
||||
EVENT2(authorize, PIByteArray, info, bool *, ok)
|
||||
|
||||
//! Client event for input server password
|
||||
EVENT1(passwordRequest, PIString *, pass)
|
||||
|
||||
//! Server event for check client password
|
||||
EVENT2(passwordCheck, PIByteArray, phash, bool *, ok)
|
||||
|
||||
|
||||
@@ -68,7 +95,7 @@ private:
|
||||
|
||||
Role role;
|
||||
State state;
|
||||
PIByteArray info;
|
||||
PIByteArray server_info;
|
||||
PICrypt crypt;
|
||||
PIByteArray sign_sk, sign_pk;
|
||||
PIByteArray auth_sign;
|
||||
|
||||
Reference in New Issue
Block a user