aboutsummaryrefslogtreecommitdiffstats
path: root/src/tls/tls_session.h
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-03-22 19:35:37 +0000
committerlloyd <[email protected]>2012-03-22 19:35:37 +0000
commit34940b08d7328a0baa51256781f5bb802a966217 (patch)
tree252b542ee2572a6f0e0d9b107c20ebb68cfe551c /src/tls/tls_session.h
parentc670e02f82087945f2c96b7cf69177ba374b27fc (diff)
Add encryption for the SQLite sessions database
Diffstat (limited to 'src/tls/tls_session.h')
-rw-r--r--src/tls/tls_session.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/tls/tls_session.h b/src/tls/tls_session.h
index ab11154c9..0c57201a4 100644
--- a/src/tls/tls_session.h
+++ b/src/tls/tls_session.h
@@ -76,17 +76,31 @@ class BOTAN_DLL Session
* Encrypt a session (useful for serialization or session tickets)
*/
MemoryVector<byte> encrypt(const SymmetricKey& key,
- RandomNumberGenerator& rng);
+ RandomNumberGenerator& rng) const;
+
/**
* Decrypt a session created by encrypt
* @param ctext the ciphertext returned by encrypt
+ * @param ctext_size the size of ctext in bytes
* @param key the same key used by the encrypting side
*/
- static Session decrypt(const MemoryRegion<byte>& ctext,
+ static Session decrypt(const byte ctext[],
+ size_t ctext_size,
const SymmetricKey& key);
/**
+ * Decrypt a session created by encrypt
+ * @param ctext the ciphertext returned by encrypt
+ * @param key the same key used by the encrypting side
+ */
+ static inline Session decrypt(const MemoryRegion<byte>& ctext,
+ const SymmetricKey& key)
+ {
+ return Session::decrypt(&ctext[0], ctext.size(), key);
+ }
+
+ /**
* Encode this session data for storage
* @warning if the master secret is compromised so is the
* session traffic