|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Defines constants for the COMMS messages of security |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef SECURITYCOMMSMESSAGEDEFS_H |
|
20 #define SECURITYCOMMSMESSAGEDEFS_H |
|
21 |
|
22 #include "comms.h" |
|
23 |
|
24 /** |
|
25 * This header file defines the COMMS messages (both requests and responses) |
|
26 * to be used communicating with JavaCertStore (the JavaCaptain plugin, which |
|
27 * hosts the certificates used for java signing). |
|
28 * |
|
29 * The syntax of the (request) COMMS messages to be used when interacting with |
|
30 * JavaCertStore is the following: |
|
31 * |
|
32 * PLUGIN_ID MESSAGE_ID OPERATION_ID [FILTER_ID FILTER_VALUE] [QUERY_ID] |
|
33 * |
|
34 * where PLUGIN_ID = PLUGIN_ID_JAVA_CERT_STORE_EXTENSION_C |
|
35 * MESSAGE_ID = JAVA_CERT_STORE_MSG_ID_REQUEST |
|
36 * OPERATION_ID = JAVA_CERT_STORE_OPERATION_QUERY_CERTS | |
|
37 * JAVA_CERT_STORE_OPERATION_DELETE_CERT | |
|
38 * JAVA_CERT_STORE_OPERATION_DISABLE_CERT | |
|
39 * JAVA_CERT_STORE_OPERATION_ENABLE_CERT | |
|
40 * JAVA_CERT_STORE_OPERATION_REFRESH_CERTS |
|
41 * FILTER_ID = JAVA_CERT_STORE_FILTER_ID_HASH | |
|
42 * JAVA_CERT_STORE_FILTER_ID_STATE |
|
43 * QUERY_ID = JAVA_CERT_STORE_QUERY_ID_PROTECTION_DOMAIN | |
|
44 * JAVA_CERT_STORE_QUERY_ID_FULL_DETAILS | |
|
45 * JAVA_CERT_STORE_QUERY_ID_CERT_CONTENT |
|
46 * Notes: |
|
47 * 1) FILTER_VALUE has one of the following values, |
|
48 * when used in conjunction with JAVA_CERT_STORE_FILTER_ID_STATE: |
|
49 * FILTER_VALUE = JAVA_CERT_STORE_STATE_ENABLED | |
|
50 * JAVA_CERT_STORE_STATE_DISABLED | |
|
51 * JAVA_CERT_STORE_STATE_DELETED |
|
52 * Otherwise the FILTER_VALUE is a String value. |
|
53 * 2) QUERY_ID is to be used only with JAVA_CERT_STORE_OPERATION_QUERY_CERTS |
|
54 * operation. If used otherwise, it is ignored. |
|
55 * 3) JAVA_CERT_STORE_OPERATION_QUERY_CERTS operation is the only operation at the |
|
56 * moment which replies (sends back a response): |
|
57 * QUERY_ID Response |
|
58 * ===================================================================================================== |
|
59 * = JAVA_CERT_STORE_QUERY_ID_PROTECTION_DOMAIN = String (protection domain) = |
|
60 * = = String (protection domain category) = |
|
61 * = = = |
|
62 * = JAVA_CERT_STORE_QUERY_ID_FULL_DETAILS = Long long (length of the cert;0 is returned = |
|
63 * = = if no matching found) = |
|
64 * = = String (the content of the certificate) = |
|
65 * = = String (hash of the certificate) = |
|
66 * = = Integer (certificate state) = |
|
67 * = = where certificate state is encoded = |
|
68 * = = on 3 bits, with MSB set to 1 if = |
|
69 * = = the certificate can be deleted = |
|
70 * = = (or 0 otherwise), the second bit = |
|
71 * = = set to 1 if the certificate can be = |
|
72 * = = disabled (or 0 otherwise) and the = |
|
73 * = = LSB set to 1 the certificate is = |
|
74 * = = disabled (or 0 othewaise) = |
|
75 * = = = |
|
76 * = JAVA_CERT_STORE_QUERY_ID_CERT_CONTENT = Long long (length of the cert;0 is returned = |
|
77 * = = if no matching found) = |
|
78 * = = String (the content of the certificate) = |
|
79 * = = = |
|
80 * = If nothing specifically was queried = String (full path to the certificate) = |
|
81 * ===================================================================================================== |
|
82 * |
|
83 * |
|
84 * Usage: Querying the full details of the enabled certificates: |
|
85 * |
|
86 * @code |
|
87 * CommsClientEndpoint cli_conn; |
|
88 * if (cli_conn.connect(IPC_ADDRESS_JAVA_CAPTAIN_C) != 0) { |
|
89 * printf("Troubles!\n"); |
|
90 * return; |
|
91 * } |
|
92 * CommsMessage s_msg; |
|
93 * CommsMessage r_msg; |
|
94 * s_msg.setModuleId(PLUGIN_ID_JAVA_CERT_STORE_EXTENSION_C); |
|
95 * s_msg.setMessageId(JAVA_CERT_STORE_MSG_ID_REQUEST); |
|
96 * s_msg << JAVA_CERT_STORE_OPERATION_QUERY_CERTS; |
|
97 * s_msg << JAVA_CERT_STORE_FILTER_ID_STATE << JAVA_CERT_STORE_STATE_ENABLED; |
|
98 * s_msg << JAVA_CERT_STORE_QUERY_ID_FULL_DETAILS; |
|
99 * if (cli_conn.sendReceive(s_msg,r_msg,10) != 0) |
|
100 * { |
|
101 * printf("Troubles!\n"); |
|
102 * return; |
|
103 * } |
|
104 * long long cert_content_len; |
|
105 * r_msg >> cert_content_len; |
|
106 * while (cert_content_len != 0) |
|
107 * { |
|
108 * std::string cert_content; |
|
109 * std::string hash: |
|
110 * int state; |
|
111 * r_msg >> cert_content; |
|
112 * r_msg >> hash; |
|
113 * r_msg >> state; |
|
114 * r_msg >> cert_content_len; |
|
115 * } |
|
116 * @endcode |
|
117 * |
|
118 * Usage: Disabling a certificate identified by hash value: |
|
119 * |
|
120 * @code |
|
121 * CommsClientEndpoint cli_conn; |
|
122 * if (cli_conn.connect(IPC_ADDRESS_JAVA_CAPTAIN_C) != 0) { |
|
123 * printf("Troubles!\n"); |
|
124 * return; |
|
125 * } |
|
126 * CommsMessage s_msg; |
|
127 * s_msg.setModuleId(PLUGIN_ID_JAVA_CERT_STORE_EXTENSION_C); |
|
128 * s_msg.setMessageId(JAVA_CERT_STORE_MSG_ID_REQUEST); |
|
129 * s_msg << JAVA_CERT_STORE_OPERATION_DISABLE_CERT; |
|
130 * s_msg << JAVA_CERT_STORE_FILTER_ID_HASH << "certHash"; |
|
131 * if (cli_conn.sendReceive(s_msg,r_msg,10) != 0) |
|
132 * { |
|
133 * printf("Troubles!\n"); |
|
134 * return; |
|
135 * } |
|
136 * @endcode |
|
137 * |
|
138 * @see JavaCertStore for details on the server-side handling on the COMMS |
|
139 * messages |
|
140 */ |
|
141 // MESSAGE_IDs |
|
142 const int JAVA_CERT_STORE_MSG_ID_REQUEST = java::comms::JAVACAPTAIN_MESSAGE_ID_RANGE_START_C + 1; |
|
143 const int JAVA_CERT_STORE_MSG_ID_RESPONSE = JAVA_CERT_STORE_MSG_ID_REQUEST + 1; |
|
144 // OPERATION_IDs |
|
145 const int JAVA_CERT_STORE_OPERATION_QUERY_CERTS = 1; |
|
146 const int JAVA_CERT_STORE_OPERATION_DELETE_CERT = 2; |
|
147 const int JAVA_CERT_STORE_OPERATION_DISABLE_CERT = 3; |
|
148 const int JAVA_CERT_STORE_OPERATION_ENABLE_CERT = 4; |
|
149 const int JAVA_CERT_STORE_OPERATION_REFRESH_CERTS = 5; |
|
150 // FILTER_IDs |
|
151 const int JAVA_CERT_STORE_FILTER_ID_HASH = 1; |
|
152 const int JAVA_CERT_STORE_FILTER_ID_STATE = 2; |
|
153 // QUERY_IDs |
|
154 const int JAVA_CERT_STORE_QUERY_ID_PROTECTION_DOMAIN = 3; |
|
155 const int JAVA_CERT_STORE_QUERY_ID_FULL_DETAILS = 4; |
|
156 const int JAVA_CERT_STORE_QUERY_ID_CERT_CONTENT = 5; |
|
157 const int JAVA_CERT_STORE_QUERY_ID_STATE = 6; |
|
158 const int JAVA_CERT_STORE_QUERY_ID_CERT_CONTENT_PEM = 7; |
|
159 // FILTER_VALUEs |
|
160 const int JAVA_CERT_STORE_STATE_ENABLED = 1; |
|
161 const int JAVA_CERT_STORE_STATE_DISABLED = 2; |
|
162 const int JAVA_CERT_STORE_STATE_DELETED = 4; |
|
163 const int JAVA_CERT_STORE_STATE_UNKNOWN = 8; |
|
164 const int JAVA_CERT_STORE_STATE_NOT_PRESENT = 16; |
|
165 |
|
166 #endif // SECURITYCOMMSMESSAGEDEFS_H |
|
167 |
|
168 |