summaryrefslogtreecommitdiff
path: root/src/components/include/security_manager/security_manager.h
diff options
context:
space:
mode:
authorAndriy Byzhynar <AByzhynar@luxoft.com>2018-02-23 17:54:43 +0200
committerAKalinich-Luxoft <AKalinich@luxoft.com>2018-06-15 17:09:13 +0300
commit2e96298b93b66ec9b9b15663d17dc62df3ab77c4 (patch)
tree9532a59c82176b115b7c7bd1c0cc4d73d0f78879 /src/components/include/security_manager/security_manager.h
parent90ee6ad4af35d9fdbc00df6c72a8fb8805f3c5da (diff)
downloadsdl_core-2e96298b93b66ec9b9b15663d17dc62df3ab77c4.tar.gz
Implement fully functional GetSystemTime feature
Implemented fully working GetSystemTime feature Fixed UT in the security manager due to code changes Disable randomly failed test
Diffstat (limited to 'src/components/include/security_manager/security_manager.h')
-rw-r--r--src/components/include/security_manager/security_manager.h46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h
index 8f772f6a13..6ad5e96989 100644
--- a/src/components/include/security_manager/security_manager.h
+++ b/src/components/include/security_manager/security_manager.h
@@ -41,6 +41,7 @@
#include "protocol_handler/session_observer.h"
#include "security_manager/security_manager_listener.h"
+#include "application_manager/policies/policy_handler_observer.h"
namespace security_manager {
@@ -50,7 +51,8 @@ class CryptoManager;
* protocol_handler::ProtocolObserver
* and provide interface for handling Security queries from mobile side
*/
-class SecurityManager : public protocol_handler::ProtocolObserver {
+class SecurityManager : public protocol_handler::ProtocolObserver,
+ public policy::PolicyHandlerObserver {
public:
/**
* \brief InternalErrors is 1 byte identifier of internal error
@@ -70,6 +72,10 @@ class SecurityManager : public protocol_handler::ProtocolObserver {
ERROR_INTERNAL = 0xFF,
ERROR_UNKNOWN_INTERNAL_ERROR = 0xFE // error value for testing
};
+
+ // SSL context creation strategy
+ enum ContextCreationStrategy { kUseExisting = 0, kForceRecreation };
+
/**
* \brief Sets pointer for Connection Handler layer for managing sessions
* \param session_observer pointer to object of the class implementing
@@ -114,13 +120,15 @@ class SecurityManager : public protocol_handler::ProtocolObserver {
}
/**
- * \brief Create new SSLContext for connection or return exists
+ * @brief Create new SSLContext for connection or return exists
* Do not notify listeners, send security error on occure
- * \param connection_key Unique key used by other components as session
+ * @param connection_key Unique key used by other components as session
* identifier
+ * @param cc_strategy - SSL context creation strategy
* @return new \c SSLContext or \c NULL on any error
*/
- virtual SSLContext* CreateSSLContext(const uint32_t& connection_key) = 0;
+ virtual SSLContext* CreateSSLContext(const uint32_t& connection_key,
+ ContextCreationStrategy cc_strategy) = 0;
/**
* \brief Start handshake as SSL client
@@ -128,10 +136,26 @@ class SecurityManager : public protocol_handler::ProtocolObserver {
virtual void StartHandshake(uint32_t connection_key) = 0;
/**
+ * @brief PostponeHandshake allows to postpone handshake. It notifies
+ * cryptomanager that certificate should be updated and adds specified
+ * connection key to the list of the certificate awaiting connections.
+ * @param connection_key the identifier for connection to postpone handshake.
+ */
+ virtual void PostponeHandshake(const uint32_t connection_key) = 0;
+
+ /**
* @brief Check whether certificate should be updated
+ * @param connection_key the connection identifier to check certificate for.
* @return true if certificate should be updated otherwise false
*/
- virtual bool IsCertificateUpdateRequired() = 0;
+ virtual bool IsCertificateUpdateRequired(const uint32_t connection_key) = 0;
+
+ /**
+ * @brief Checks whether system time ready notification
+ * was received from hmi
+ * @return true if received otherwise false
+ */
+ virtual bool IsSystemTimeProviderReady() const = 0;
/**
* @brief Notify all listeners that certificate update required
@@ -150,6 +174,18 @@ class SecurityManager : public protocol_handler::ProtocolObserver {
*/
virtual void AddListener(SecurityManagerListener* const listener) = 0;
virtual void RemoveListener(SecurityManagerListener* const listener) = 0;
+
+ /**
+ * @brief OnCertificateUpdated allows to obtain notification when certificate
+ * has been updated with policy table update. Pass this certificate to crypto
+ * manager for further processing. Also process postopnes handshake for the
+ * certain connection key.
+ *
+ * @param data the certificates content.
+ *
+ * @return always true.
+ */
+ virtual bool OnCertificateUpdated(const std::string& data) = 0;
};
} // namespace security_manager
#endif // SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_H_