Mir
|
A source of moderately-difficult-to-spoof cookies. More...
#include <cookie_factory.h>
Public Member Functions | |
CookieFactory (CookieFactory const &factory)=delete | |
CookieFactory & | operator= (CookieFactory const &factory)=delete |
virtual | ~CookieFactory () noexcept=default |
virtual MirCookie | timestamp_to_cookie (uint64_t const ×tamp)=0 |
Turns a timestamp into a MAC and returns a MirCookie. More... | |
virtual bool | attest_timestamp (MirCookie const &cookie)=0 |
Checks that a MirCookie is a valid MirCookie. More... | |
Static Public Member Functions | |
static size_t | optimal_secret_size () |
Optimal size for the provided Secret. More... | |
static std::unique_ptr< CookieFactory > | create_from_secret (Secret const &secret) |
Construction function used to create a CookieFactory. More... | |
static std::unique_ptr< CookieFactory > | create_saving_secret (Secret &save_secret) |
Construction function used to create a CookieFactory as well as a secret. More... | |
static std::unique_ptr< CookieFactory > | create_keeping_secret () |
Construction function used to create a CookieFactory and a secret which it keeps internally. More... | |
Static Public Attributes | |
static unsigned const | minimum_secret_size = 8 |
Absolute minimum size of secret key the CookieFactory will accept. More... | |
Protected Member Functions | |
CookieFactory ()=default | |
A source of moderately-difficult-to-spoof cookies.
The primary motivation for this is to provide event timestamps that clients find it difficult to spoof. This is useful for focus grant and similar operations where shell behaviour should be dependent on the timestamp of the client event that caused the request.
Some spoofing protection is desirable; experience with X clients shows that they will go to some effort to attempt to bypass focus stealing prevention.
|
delete |
|
virtualdefaultnoexcept |
|
protecteddefault |
|
pure virtual |
|
static |
Construction function used to create a CookieFactory.
The secret size must be no less then minimum_secret_size otherwise an exception will be thrown
[in] | secret | A filled in secret used to set the key for the hash function |
|
static |
Construction function used to create a CookieFactory and a secret which it keeps internally.
|
static |
Construction function used to create a CookieFactory as well as a secret.
[out] | save_secret | The secret that was created. |
|
delete |
|
static |
Optimal size for the provided Secret.
This is the maximum useful size of the secret key. Keys of greater size will be reduced to this size internally, and keys of smaller size may be internally extended to this size.
|
pure virtual |
|
static |
Absolute minimum size of secret key the CookieFactory will accept.
Code should be using optimum_secret_size(); this minimum size is provided as a user convenience to guard against catastrophically bad initialisation.
Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015