scep_common.h
Go to the documentation of this file.
1 /**
2  * @file scep_common.h
3  * @brief SCEP common definitions
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2024-2025 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSCEP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.5.4
29  **/
30 
31 #ifndef _SCEP_COMMON_H
32 #define _SCEP_COMMON_H
33 
34 //Dependencies
35 #include "scep_config.h"
36 #include "core/crypto.h"
37 #include "pkix/x509_common.h"
38 
39 
40 /*
41  * CycloneSCEP Open is licensed under GPL version 2. In particular:
42  *
43  * - If you link your program to CycloneSCEP Open, the result is a derivative
44  * work that can only be distributed under the same GPL license terms.
45  *
46  * - If additions or changes to CycloneSCEP Open are made, the result is a
47  * derivative work that can only be distributed under the same license terms.
48  *
49  * - The GPL license requires that you make the source code available to
50  * whoever you make the binary available to.
51  *
52  * - If you sell or distribute a hardware product that runs CycloneSCEP Open,
53  * the GPL license requires you to provide public and full access to all
54  * source code on a nondiscriminatory basis.
55  *
56  * If you fully understand and accept the terms of the GPL license, then edit
57  * the os_port_config.h header and add the following directive:
58  *
59  * #define GPL_LICENSE_TERMS_ACCEPTED
60  */
61 
62 #ifndef GPL_LICENSE_TERMS_ACCEPTED
63  #error Before compiling CycloneSCEP Open, you must accept the terms of the GPL license
64 #endif
65 
66 //Version string
67 #define CYCLONE_SCEP_VERSION_STRING "2.5.4"
68 //Major version
69 #define CYCLONE_SCEP_MAJOR_VERSION 2
70 //Minor version
71 #define CYCLONE_SCEP_MINOR_VERSION 5
72 //Revision number
73 #define CYCLONE_SCEP_REV_NUMBER 4
74 
75 //Nonce size
76 #define SCEP_NONCE_SIZE 16
77 
78 //C++ guard
79 #ifdef __cplusplus
80 extern "C" {
81 #endif
82 
83 
84 /**
85  * @brief SCEP message types
86  **/
87 
88 typedef enum
89 {
90  SCEP_MSG_TYPE_RESERVED = 0, ///<Reserved
91  SCEP_MSG_TYPE_CERT_REP = 3, ///<CertRep
92  SCEP_MSG_TYPE_RENEWAL_REQ = 17, ///<RenewalReq
93  SCEP_MSG_TYPE_PKCS_REQ = 19, ///<PKCSReq
94  SCEP_MSG_TYPE_CERT_POLL = 20, ///<CertPoll
95  SCEP_MSG_TYPE_GET_CERT = 21, ///<GetCert
96  SCEP_MSG_TYPE_GET_CRL = 22 ///<GetCRL
98 
99 
100 /**
101  * @brief PKI status
102  **/
103 
104 typedef enum
105 {
106  SCEP_PKI_STATUS_SUCCESS = 0, ///<Success
107  SCEP_PKI_STATUS_FAILURE = 2, ///<Failure
108  SCEP_PKI_STATUS_PENDING = 3 ///<Pending
110 
111 
112 /**
113  * @brief Fail info
114  **/
115 
116 typedef enum
117 {
118  SCEP_FAIL_INFO_BAD_ALG = 0, ///<badAlg
119  SCEP_FAIL_INFO_BAD_MESSAGE_CHECK = 1, ///<badMessageCheck
120  SCEP_FAIL_INFO_BAD_REQUEST = 2, ///<badRequest
121  SCEP_FAIL_INFO_BAD_TIME = 3, ///<badTime
122  SCEP_FAIL_INFO_BAD_CERT_ID = 4 ///<badCertId
124 
125 
126 /**
127  * @brief CA capabilities
128  */
129 
130 typedef enum
131 {
132  SCEP_CA_CAPS_NONE = 0x00, ///<None
133  SCEP_CA_CAPS_AES = 0x01, ///<AES
134  SCEP_CA_CAPS_DES3 = 0x02, ///<DES3
135  SCEP_CA_CAPS_GET_NEXT_CA_CERT = 0x04, ///<GetNextCACert
136  SCEP_CA_CAPS_POST_PKI_OPERATION = 0x08, ///<POSTPKIOperation
137  SCEP_CA_CAPS_RENEWAL = 0x10, ///<Renewal
138  SCEP_CA_CAPS_SHA1 = 0x20, ///<SHA-1
139  SCEP_CA_CAPS_SHA256 = 0x40, ///<SHA-256
140  SCEP_CA_CAPS_SHA512 = 0x80, ///<SHA-512
141 } ScepCaCaps;
142 
143 
144 /**
145  * @brief Issuer and subject
146  **/
147 
148 typedef struct
149 {
153 
154 
155 //SCEP related constants
156 extern const uint8_t SCEP_MESSAGE_TYPE_OID[10];
157 extern const uint8_t SCEP_PKI_STATUS_OID[10];
158 extern const uint8_t SCEP_FAIL_INFO_OID[10];
159 extern const uint8_t SCEP_SENDER_NONCE_OID[10];
160 extern const uint8_t SCEP_RECIPIENT_NONCE_OID[10];
161 extern const uint8_t SCEP_TRANSACTION_ID_OID[10];
162 extern const uint8_t SCEP_FAIL_INFO_TEXT_OID[8];
163 
164 //C++ guard
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif
const uint8_t SCEP_TRANSACTION_ID_OID[10]
Definition: scep_common.c:52
const uint8_t SCEP_MESSAGE_TYPE_OID[10]
Definition: scep_common.c:42
@ SCEP_MSG_TYPE_PKCS_REQ
PKCSReq.
Definition: scep_common.h:93
@ SCEP_MSG_TYPE_CERT_REP
CertRep.
Definition: scep_common.h:91
X.509 common definitions.
@ SCEP_CA_CAPS_POST_PKI_OPERATION
POSTPKIOperation.
Definition: scep_common.h:136
@ SCEP_PKI_STATUS_FAILURE
Failure.
Definition: scep_common.h:107
const uint8_t SCEP_RECIPIENT_NONCE_OID[10]
Definition: scep_common.c:50
const uint8_t SCEP_FAIL_INFO_OID[10]
Definition: scep_common.c:46
@ SCEP_FAIL_INFO_BAD_MESSAGE_CHECK
badMessageCheck
Definition: scep_common.h:119
@ SCEP_FAIL_INFO_BAD_ALG
badAlg
Definition: scep_common.h:118
@ SCEP_PKI_STATUS_SUCCESS
Success.
Definition: scep_common.h:106
@ SCEP_FAIL_INFO_BAD_REQUEST
badRequest
Definition: scep_common.h:120
@ SCEP_CA_CAPS_AES
AES.
Definition: scep_common.h:133
@ SCEP_MSG_TYPE_GET_CRL
GetCRL.
Definition: scep_common.h:96
const uint8_t SCEP_FAIL_INFO_TEXT_OID[8]
Definition: scep_common.c:54
@ SCEP_CA_CAPS_RENEWAL
Renewal.
Definition: scep_common.h:137
@ SCEP_FAIL_INFO_BAD_CERT_ID
badCertId
Definition: scep_common.h:122
@ SCEP_MSG_TYPE_RENEWAL_REQ
RenewalReq.
Definition: scep_common.h:92
const uint8_t SCEP_PKI_STATUS_OID[10]
Definition: scep_common.c:44
General definitions for cryptographic algorithms.
@ SCEP_CA_CAPS_SHA1
SHA-1.
Definition: scep_common.h:138
ScepFailInfo
Fail info.
Definition: scep_common.h:117
ScepCaCaps
CA capabilities.
Definition: scep_common.h:131
@ SCEP_FAIL_INFO_BAD_TIME
badTime
Definition: scep_common.h:121
@ SCEP_CA_CAPS_NONE
None.
Definition: scep_common.h:132
@ SCEP_CA_CAPS_DES3
DES3.
Definition: scep_common.h:134
@ SCEP_MSG_TYPE_GET_CERT
GetCert.
Definition: scep_common.h:95
@ SCEP_CA_CAPS_SHA256
SHA-256.
Definition: scep_common.h:139
Issuer or subject name.
Definition: x509_common.h:725
@ SCEP_MSG_TYPE_RESERVED
Reserved.
Definition: scep_common.h:90
ScepMessageType
SCEP message types.
Definition: scep_common.h:89
@ SCEP_MSG_TYPE_CERT_POLL
CertPoll.
Definition: scep_common.h:94
@ SCEP_PKI_STATUS_PENDING
Pending.
Definition: scep_common.h:108
const uint8_t SCEP_SENDER_NONCE_OID[10]
Definition: scep_common.c:48
@ SCEP_CA_CAPS_SHA512
SHA-512.
Definition: scep_common.h:140
Issuer and subject.
Definition: scep_common.h:149
@ SCEP_CA_CAPS_GET_NEXT_CA_CERT
GetNextCACert.
Definition: scep_common.h:135
ScepPkiStatus
PKI status.
Definition: scep_common.h:105