libDwmAuth-0.1.2
DwmAuth.hh File Reference

Simple authentication definitions. More...

Include dependency graph for DwmAuth.hh:

Go to the source code of this file.

Functions

bool Dwm::Auth::AuthenticateClient (int fd, const PKCrypto::KeyPair &myKeys, const std::string &secret)
 Authenticate a client that has connected on the socket fd. More...
 
bool Dwm::Auth::AuthenticateServer (int fd, const PKCrypto::KeyPair &myKeys, const std::string &secret)
 Authenticate to a server to which we've connected on socket fd. More...
 
std::string Dwm::Auth::GetRandomString (size_t sz)
 Returns a random string of length sz.
 
std::string Dwm::Auth::HexEncodedString (const std::string &s)
 Returns a hexadecimal version of s.
 
std::string Dwm::Auth::Base64Encode (const std::string &s)
 Returns a base64-encoded version of s.
 

Detailed Description

Simple authentication definitions.

Function Documentation

◆ AuthenticateClient()

bool Dwm::Auth::AuthenticateClient ( int  fd,
const PKCrypto::KeyPair myKeys,
const std::string &  secret 
)

Authenticate a client that has connected on the socket fd.

We will send them our public key from myKeys so that they can encrypt their response with it. They will send us their public key which we will use to encrypt our challenge. We will send an IV and a random string that is encrypted with the shared secret key symKey and an IV. They must decrypt the random string correctly and send the decrypted string back to us, encrypted with our public key. DEPRECATED. USE Dwm::Auth::PeerAuthenticator!!!!

◆ AuthenticateServer()

bool Dwm::Auth::AuthenticateServer ( int  fd,
const PKCrypto::KeyPair myKeys,
const std::string &  secret 
)

Authenticate to a server to which we've connected on socket fd.

DEPRECATED. USE Dwm::Auth::PeerAuthenticator!!!!