Skip to content

Commit ffcfa9b

Browse files
Elisey ZamakhovElisey Zamakhov
Elisey Zamakhov
authored and
Elisey Zamakhov
committed
Add Security Manager SDD example
Copied the current SDD information and diagrams Related issue: APPLINK-25051
1 parent 834e301 commit ffcfa9b

8 files changed

+245
-2
lines changed

Doxyfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ RECURSIVE = YES
838838
# run.
839839

840840
EXCLUDE = **/CMakeLists.txt \
841-
docs/software_detailed_design_template.dox \
841+
docs/FORD.OpenSDL.SDD.TPL.dox
842842
src/components/test_main.cc
843843
src/thirdPartyLibs \
844844
tools/FlexeLint \
@@ -898,7 +898,8 @@ EXAMPLE_RECURSIVE = NO
898898
# that contain images that are to be included in the documentation (see the
899899
# \image command).
900900

901-
IMAGE_PATH =
901+
IMAGE_PATH = \
902+
src/components/security_manager/docs/assets
902903

903904
# The INPUT_FILTER tag can be used to specify a program that doxygen should
904905
# invoke to filter for each input file. Doxygen will invoke the filter program

docs/mainpage.dox

+1
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@
66
* For getting SmartDeviceLink overview, please, refer to [Software Architecture Document](https://smartdevicelink.com/en/docs/core/master/software-architecture-document/table-of-contents/)
77
*
88
* ##Table of contents
9+
* - \ref security_manager
910
*/
1011
//-----------------------------------------------------------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
/**
2+
\page security_manager Security Manager Detailed Design
3+
## Table of contents
4+
- \subpage security_manager_intoduction
5+
+ \ref security_manager_rationale "1.1 Rationale"
6+
+ \ref security_manager_scope "1.2 Scope"
7+
+ \ref security_manager_abbreviations "1.3 Abbreviations"
8+
- \subpage security_manager_detail_design
9+
+ \ref security_manager_design_solutions "2.1 Design solutions"
10+
+ \ref security_manager_class_structure "2.2 Class Structure"
11+
+ \ref security_manager_sequence_diagram "2.3 Sequence diagram"
12+
+ \ref security_manager_state_chart "2.4 State chart diagram"
13+
- \subpage security_manager_interfaces
14+
+ \ref security_manager_public_interfaces "3.1 Public interfaces description"
15+
+ \ref security_manager_internal_interfaces "3.2 Internal interfaces description"
16+
+ \ref security_manager_derived_interfaces "3.3 Derived interfaces and dependencies"
17+
- \subpage security_manager_data_structure_resources
18+
+ \ref security_manager_data_structure "4.1 Element Data Structure"
19+
+ \ref security_manager_resources "4.2 Resource usage"
20+
- \subpage security_manager_references_and_history
21+
+ \ref security_manager_references "5.1 References"
22+
+ \ref security_manager_history "5.2 Document history change and approve"
23+
*/
24+
//-----------------------------------------------------------
25+
/**
26+
\page security_manager_intoduction 1 Introduction
27+
The document is intended to support software developers,
28+
maintenance and integration engineers with sufficient,
29+
detailed information concerning the design, development and
30+
deployment concepts, to accomplish their respective tasks without reliance on the authors.
31+
32+
\anchor security_manager_rationale
33+
## 1.1 Rationale
34+
Security Manager implements SDL Architectural Solution according to:
35+
- https://smartdevicelink.com/en/guides/core/software-architecture-document/components-view/#security-manager
36+
37+
\anchor security_manager_scope
38+
## 1.2 Scope
39+
Security Manager component extracted as a separate module for
40+
Ford channel data protection.
41+
This components is used to:
42+
- Provide security communications
43+
- Protect income and outcome business layer data from interception
44+
- Verify the relation between a mobile application certificate and its owner
45+
46+
\anchor security_manager_abbreviations
47+
## 1.3 Abbreviations
48+
Abbreviations used in this document please find in the table below.
49+
| Abbreviation | Expansion |
50+
|------------------|----------------------------------|
51+
| SSL | Secure Sockets Layer cryptographic protocol |
52+
| TLS | Transport Layer Security cryptographic protocol |
53+
| DTLS | Datagram TLS cryptographic protocol |
54+
55+
Definitions used in this document are in the table below.
56+
57+
| Definition | Description |
58+
|---------------------------|-----------------------------------|
59+
| SSL/TLS/DTL | Cryptographic protocols that provide communications security over a computer network |
60+
*/
61+
//-----------------------------------------------------------
62+
/**
63+
\page security_manager_detail_design 2 Component detail design
64+
\anchor security_manager_design_solutions
65+
### 2.1 Design solutions
66+
The following design approaches and pattern was used for Security Manager:
67+
- Protection, creation and business logic is spitted to separates interfaces
68+
+ SecurityManager for handling Security queries from mobile side
69+
+ SSLContext provides for SSL connection establishing, encryption and decryption
70+
+ CryptoManager provides a factory for SSLContext
71+
- [Abstract Factory pattern design](https://sourcemaking.com/design_patterns/abstract_factory)
72+
used for SSLContext objects creation
73+
+ It also guaranty correctness of SSLContext destruction by the
74+
same Compiled SecurityManager object
75+
76+
#### Design description
77+
security_manager::SSLContext is an interface for TLS connection establishing, data encryption and
78+
decryption within this connection.
79+
security_manager::SSLContextImpl implements SSLContext and wraps OpenSSL library handshake procedure,
80+
encryption and decryption, contains handshake procedure error handling.
81+
_Note:_ security_manager::SSLContext objects are stored in connection_handler::ConnectionHandlerImpl,
82+
which implements protocol_handler::SessionObserver interface.
83+
84+
security_manager::CryptoManager is an interface for SSLContext creation and destruction,
85+
CA certificate update and last SSL error providing.
86+
security_manager::CryptoManagerImpl implements security_manager::CryptoManager and hides
87+
all OpenSSL initialization logics and SSL internal structures creation.
88+
89+
security_manager::SecurityManager is a Facade of security_manager component and provides
90+
external interface for security_manager::SSLContext creation and sending security error
91+
via control service.
92+
security_manager::SecurityManagerImpl implements security_manager::SecurityManager and
93+
encapsulates control service data (security internal errors, handshake data) handling.
94+
95+
security_manager::SecurityManagerListener is an interface for protection result notification
96+
to other components.
97+
security_manager::SecurityManagerListener is implemented in a protocol_handler::ProtocolHandlerImpl for sending
98+
protocol layer response on handshake procedure finish.
99+
100+
101+
\anchor security_manager_class_structure
102+
### 2.2 Class Structure
103+
The following UML class digram shows the component structure.
104+
![Security Manager class diagram](sm_class_digram.png)
105+
For more information about class digram follow:
106+
- http://www.uml-diagrams.org/class-diagrams-overview.htqml
107+
- https://sourcemaking.com/uml/modeling-it-systems/structural-view/class-diagram
108+
109+
\anchor security_manager_sequence_diagram
110+
### 2.3 Sequence diagram
111+
The following UML sequence digram shows the component dynamic behavior.
112+
For more information about sequence digram follow:
113+
- http://www.uml-diagrams.org/sequence-diagrams.html
114+
- https://sourcemaking.com/uml/modeling-it-systems/external-view/use-case-sequence-diagram
115+
116+
Security first initialization on session:
117+
![Start encryption](sm_sequence_digram_init.png)
118+
119+
Security initialization for service on session with already initialized security:
120+
![Initialization](sm_sequence_digram_verify.png)
121+
122+
Decryption procedure:
123+
![Decryption](sm_sequence_digram_decryption.png)
124+
125+
Encryption procedure:
126+
![Encryption](sm_sequence_digram_encryption.png)
127+
128+
\anchor security_manager_state_chart
129+
### 2.4 State chart diagram
130+
Not applicable for Security Manager.
131+
*/
132+
//-----------------------------------------------------------
133+
/**
134+
\page security_manager_interfaces 3 Component Interfaces
135+
\anchor security_manager_public_interfaces
136+
### 3.1 Public interfaces description
137+
Security Manager provides functionality with following interfaces:
138+
- security_manager::SecurityManager
139+
- security_manager::SecurityManagerListener
140+
- security_manager::SSLContext
141+
142+
\anchor security_manager_internal_interfaces
143+
### 3.2 Internal interfaces description
144+
The following interfaces are provided by component for internal usage only:
145+
- security_manager::CryptoManager
146+
- security_manager::CryptoManagerSettings
147+
148+
\anchor security_manager_derived_interfaces
149+
### 3.3 Derived interfaces and dependencies
150+
Security Manager required following 3d-party libraries:
151+
- OpenSSL library v 1.0.1g and higher to meet TLS cipher restricts
152+
153+
The following interfaces are required by component:
154+
- \ref src/components/include/utils Utils
155+
- protocol_handler::ProtocolObserver for getting Protocol notifications
156+
- implements protocol_handler::SessionObserver for providing SSLContext object managing
157+
- [OpenSSL API](https://www.openssl.org/docs/manmaster/ssl/)
158+
+ [SSL_library_init()](https://www.openssl.org/docs/manmaster/ssl/SSL_library_init.html)
159+
- registers the available SSL/TLS ciphers and digests.
160+
+ [SSL_METHOD](https://www.openssl.org/docs/manmaster/ssl/ssl.html)
161+
- That's a dispatch structure describing the internal ssl library methods/functions which implement the various protocol versions (SSLv3 TLSv1, ...). It's needed to create an SSL_CTX.
162+
+ [(D)TLSv1(_1/2)_(server/client)_method, ]
163+
(https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_new.html)
164+
- TLS/SSL connections established with these methods will understand the TLSv1 protocol.
165+
- A client will send out TLSv1 client hello messages and will indicate that it only understands TLSv1. A server will only understand TLSv1 client hello messages.
166+
+ [SSL_CTX_new](https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_new.html)
167+
- creates a new SSL_CTX object as framework to establish TLS/SSL enabled connections.
168+
+ [SSL_CTX_free](https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_free.html)
169+
- decrements the reference count of ctx, and removes the SSL_CTX object pointed to by ctx and frees up the allocated memory if the the reference count has reached 0.
170+
+ [SSL_CTX_use_certificate_file, SSL_CTX_use_PrivateKey_file, SSL_CTX_check_private_key]
171+
(https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_use_certificate.html)
172+
- load certificate and key data
173+
+ [SSL_CTX_set_cipher_list](https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_set_cipher_list.html)
174+
- choose list of available [cipher suites](https://en.wikipedia.org/wiki/Cipher_suite)
175+
+ [SSL_new](https://www.openssl.org/docs/manmaster/ssl/SSL_new.html)
176+
- creates a new SSL structure which is needed to hold the data for a TLS/SSL connection. The new structure inherits the settings of the underlying context ctx: connection method, options, verification settings, timeout settings.
177+
+ [SSL_CTX_set_verify](https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_set_verify.html)
178+
- sets the verification flags for ctx to be mode and specifies the verify_callback function to be used.
179+
+ [SSL_CTX_load_verify_locations](https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_load_verify_locations.html)
180+
- specifies the locations for ctx, at which CA certificates for verification purposes are located.
181+
+ [X509_STORE_CTX_get_error, X509_STORE_CTX_set_error](https://www.openssl.org/docs/manmaster/crypto/X509_STORE_CTX_set_error.html)
182+
- get or set certificate verification status information
183+
+ [SSL_do_handshake](https://www.openssl.org/docs/manmaster/ssl/SSL_do_handshake.html)
184+
- waits for a SSL/TLS handshake to take place. If the connection is in client mode, the handshake will be started.
185+
- The handshake routines may have to be explicitly set in advance using either SSL_set_connect_state or SSL_set_accept_state.
186+
+ [SSL_shutdown](https://www.openssl.org/docs/manmaster/ssl/SSL_shutdown.html)
187+
- shuts down an active TLS/SSL connection. It sends the "close notify" shutdown alert to the peer.
188+
+ [SSL_free](https://www.openssl.org/docs/manmaster/ssl/SSL_free.html)
189+
- decrements the reference count of ssl, and removes the SSL structure pointed to by ssl
190+
- frees up the allocated memory if the reference count has reached 0.
191+
+[BIO_new, BIO_set, BIO_free, BIO_vfree, BIO_free_all](https://www.openssl.org/docs/manmaster/crypto/bio.html)
192+
- BIO allocation and freeing functions
193+
+ [BIO_read, BIO_write, BIO_gets, BIO_puts](https://www.openssl.org/docs/manmaster/crypto/BIO_read.html)
194+
- BIO I/O functions
195+
*/
196+
//-----------------------------------------------------------
197+
/**
198+
\page security_manager_data_structure_resources 4 Component data and resources
199+
\anchor security_manager_data_structure
200+
### 4.1 Element Data Structure
201+
The following data types are used by the Component:
202+
- security_manager::SecurityQuery
203+
- protocol_handler::ProtocolPacket
204+
205+
The format of certificate data exchange is:
206+
- PEM certificates according to [APPLINK-21512](https://adc.luxoft.com/jira/browse/APPLINK-21512)
207+
208+
\anchor security_manager_resources
209+
### 4.2 Resource usage
210+
Security Manager get an assess to certificate and private key
211+
data using OpenSSl API.
212+
*/
213+
//-----------------------------------------------------------
214+
/**
215+
\page security_manager_references_and_history 5 References and history
216+
\anchor security_manager_references
217+
### 5.1 References
218+
- [Software Architecture Document](https://smartdevicelink.com/en/guides/core/software-architecture-document/table-of-contents/)
219+
- [OpenSSL API](https://www.openssl.org/docs/manmaster/ssl/)
220+
- [TLS 1.1 RFC](https://tools.ietf.org/html/rfc4346)
221+
- [TLS 1.2 RFC](https://tools.ietf.org/html/rfc5246)
222+
- [DTLS RFC](https://tools.ietf.org/html/rfc4347)
223+
224+
\anchor security_manager_history
225+
### 5.2 Document history
226+
Document change history
227+
228+
| Version | Data | Author/Editor | Change description |
229+
|-------------|------------|----------------------------------------|---------------------|
230+
| 0.1 | 08/11/2016 | [EZamakhov](https://github.com/pestOO) | Initial version from the previous [SDL SDD](https://adc.luxoft.com/confluence/pages/viewpage.action?pageId=279677125) |
231+
232+
Document approve history
233+
234+
| Version | Data | Author/Editor | Change description |
235+
|-------------|------------|-----------------------------|---------------------|
236+
| | | | |
237+
238+
For more precise document change history follow github history -
239+
- https://github.com/smartdevicelink/sdl_core/commits/master/src/components/security_manager/docs/security_manager_software_detailed_design.dox
240+
- https://github.com/smartdevicelink/sdl_core/commits/develop/src/components/security_manager/docs/security_manager_software_detailed_design.dox
241+
*/
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)