Refactor KeyManager and TagRecogniser, implement new key rotation logic.
This patch implements the new key rotation logic for BTP version 2, the new transport protocol (#111 (closed)).
KeyManager and TagRecogniser have been merged (#55 (closed)). They no longer need to hold locks while calling each other's methods (#3 (closed), #4 (closed)). TransportKeyManager holds a lock while calling CryptoComponent methods, but those methods don't block or acquire any locks.
The maximum clock difference has been increased from one hour to 24 hours because some people adjust the time rather than the timezone when travelling (#18). This will cause keys to be rotated less frequently.
For the same reason, the key manager no longer throws an Error when the clock moves backwards - keys that belong to future rotation periods are kept until they become current, then rotation resumes (#19 (closed)).
The new KeyManagerImpl and TransportKeyManager need unit tests. I'm putting this up for review while I write the tests.
TransportKeyManager needs further work before #55 (closed) is complete - when a stream context is created, TransportKeyManager should wait for the database write to complete before returning the context, to avoid the risk of key reuse if the write fails. I'll make a separate patch for that as this one's big enough already.
Enjoy!