cppcms::sessions::encryptor Class Referenceabstract

This is an interface to generic session cookies encryption or signing API. More...

`#include <cppcms/session_cookies.h>`

Inheritance diagram for cppcms::sessions::encryptor:

## Public Member Functions

virtual std::string | encrypt (std::string const &plain)=0
virtual bool | decrypt (std::string const &cipher, std::string &plain)=0
virtual | ~encryptor ()

## Detailed Description

This is an interface to generic session cookies encryption or signing API.

Note for users implementing their own ecryptor classes:

- Be super paranoid and extremely careful in what you are doing.
- Take in mind that this object are created and destroyed much frequently then they are actually accessed, so lazy initialization is your best friend.

Note this class does not have to be thread safe to use from multiple threads.

## Constructor & Destructor Documentation

virtual cppcms::sessions::encryptor::~encryptor | ( |  | ) |

inlinevirtual

Destructor

## Member Function Documentation

virtual bool cppcms::sessions::encryptor::decrypt | ( | std::string const & | cipher,
|  | std::string & | plain
| ) |  |

pure virtual

Decrypt the cipher text or check the signature and return the plain text and the session expiration value: timeout.

If signature checks or decryption failed return false.

virtual std::string cppcms::sessions::encryptor::encrypt | ( | std::string const & | plain | ) |

pure virtual

Encrypt or sign the plain text plain together with timeout and return the encrypted value for a cookie. Don't forget to use base64 encoding in order to create a string that is valid for cookie

The documentation for this class was generated from the following file:

- cppcms/session_cookies.h