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) 2010-2025 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneCRYPTO 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.2
29  **/
30 
31 #ifndef _SCEP_COMMON_H
32 #define _SCEP_COMMON_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkix/x509_common.h"
37 
38 //Nonce size
39 #define SCEP_NONCE_SIZE 16
40 
41 //C++ guard
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 
47 /**
48  * @brief SCEP message types
49  **/
50 
51 typedef enum
52 {
53  SCEP_MSG_TYPE_RESERVED = 0, ///<Reserved
54  SCEP_MSG_TYPE_CERT_REP = 3, ///<CertRep
55  SCEP_MSG_TYPE_RENEWAL_REQ = 17, ///<RenewalReq
56  SCEP_MSG_TYPE_PKCS_REQ = 19, ///<PKCSReq
57  SCEP_MSG_TYPE_CERT_POLL = 20, ///<CertPoll
58  SCEP_MSG_TYPE_GET_CERT = 21, ///<GetCert
59  SCEP_MSG_TYPE_GET_CRL = 22 ///<GetCRL
61 
62 
63 /**
64  * @brief PKI status
65  **/
66 
67 typedef enum
68 {
69  SCEP_PKI_STATUS_SUCCESS = 0, ///<Success
70  SCEP_PKI_STATUS_FAILURE = 2, ///<Failure
71  SCEP_PKI_STATUS_PENDING = 3 ///<Pending
73 
74 
75 /**
76  * @brief Fail info
77  **/
78 
79 typedef enum
80 {
81  SCEP_FAIL_INFO_BAD_ALG = 0, ///<badAlg
82  SCEP_FAIL_INFO_BAD_MESSAGE_CHECK = 1, ///<badMessageCheck
83  SCEP_FAIL_INFO_BAD_REQUEST = 2, ///<badRequest
84  SCEP_FAIL_INFO_BAD_TIME = 3, ///<badTime
85  SCEP_FAIL_INFO_BAD_CERT_ID = 4 ///<badCertId
87 
88 
89 /**
90  * @brief CA capabilities
91  */
92 
93 typedef enum
94 {
95  SCEP_CA_CAPS_NONE = 0x00, ///<None
96  SCEP_CA_CAPS_AES = 0x01, ///<AES
97  SCEP_CA_CAPS_DES3 = 0x02, ///<DES3
98  SCEP_CA_CAPS_GET_NEXT_CA_CERT = 0x04, ///<GetNextCACert
99  SCEP_CA_CAPS_POST_PKI_OPERATION = 0x08, ///<POSTPKIOperation
100  SCEP_CA_CAPS_RENEWAL = 0x10, ///<Renewal
101  SCEP_CA_CAPS_SHA1 = 0x20, ///<SHA-1
102  SCEP_CA_CAPS_SHA256 = 0x40, ///<SHA-256
103  SCEP_CA_CAPS_SHA512 = 0x80, ///<SHA-512
104 } ScepCaCaps;
105 
106 
107 /**
108  * @brief Issuer and subject
109  **/
110 
111 typedef struct
112 {
116 
117 
118 //SCEP related constants
119 extern const uint8_t SCEP_MESSAGE_TYPE_OID[10];
120 extern const uint8_t SCEP_PKI_STATUS_OID[10];
121 extern const uint8_t SCEP_FAIL_INFO_OID[10];
122 extern const uint8_t SCEP_SENDER_NONCE_OID[10];
123 extern const uint8_t SCEP_RECIPIENT_NONCE_OID[10];
124 extern const uint8_t SCEP_TRANSACTION_ID_OID[10];
125 extern const uint8_t SCEP_FAIL_INFO_TEXT_OID[8];
126 
127 //C++ guard
128 #ifdef __cplusplus
129 }
130 #endif
131 
132 #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:56
@ SCEP_MSG_TYPE_CERT_REP
CertRep.
Definition: scep_common.h:54
X.509 common definitions.
@ SCEP_CA_CAPS_POST_PKI_OPERATION
POSTPKIOperation.
Definition: scep_common.h:99
@ SCEP_PKI_STATUS_FAILURE
Failure.
Definition: scep_common.h:70
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:82
@ SCEP_FAIL_INFO_BAD_ALG
badAlg
Definition: scep_common.h:81
@ SCEP_PKI_STATUS_SUCCESS
Success.
Definition: scep_common.h:69
@ SCEP_FAIL_INFO_BAD_REQUEST
badRequest
Definition: scep_common.h:83
@ SCEP_CA_CAPS_AES
AES.
Definition: scep_common.h:96
@ SCEP_MSG_TYPE_GET_CRL
GetCRL.
Definition: scep_common.h:59
const uint8_t SCEP_FAIL_INFO_TEXT_OID[8]
Definition: scep_common.c:54
@ SCEP_CA_CAPS_RENEWAL
Renewal.
Definition: scep_common.h:100
@ SCEP_FAIL_INFO_BAD_CERT_ID
badCertId
Definition: scep_common.h:85
@ SCEP_MSG_TYPE_RENEWAL_REQ
RenewalReq.
Definition: scep_common.h:55
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:101
ScepFailInfo
Fail info.
Definition: scep_common.h:80
ScepCaCaps
CA capabilities.
Definition: scep_common.h:94
@ SCEP_FAIL_INFO_BAD_TIME
badTime
Definition: scep_common.h:84
@ SCEP_CA_CAPS_NONE
None.
Definition: scep_common.h:95
@ SCEP_CA_CAPS_DES3
DES3.
Definition: scep_common.h:97
@ SCEP_MSG_TYPE_GET_CERT
GetCert.
Definition: scep_common.h:58
@ SCEP_CA_CAPS_SHA256
SHA-256.
Definition: scep_common.h:102
Issuer or subject name.
Definition: x509_common.h:723
@ SCEP_MSG_TYPE_RESERVED
Reserved.
Definition: scep_common.h:53
ScepMessageType
SCEP message types.
Definition: scep_common.h:52
@ SCEP_MSG_TYPE_CERT_POLL
CertPoll.
Definition: scep_common.h:57
@ SCEP_PKI_STATUS_PENDING
Pending.
Definition: scep_common.h:71
const uint8_t SCEP_SENDER_NONCE_OID[10]
Definition: scep_common.c:48
@ SCEP_CA_CAPS_SHA512
SHA-512.
Definition: scep_common.h:103
Issuer and subject.
Definition: scep_common.h:112
@ SCEP_CA_CAPS_GET_NEXT_CA_CERT
GetNextCACert.
Definition: scep_common.h:98
ScepPkiStatus
PKI status.
Definition: scep_common.h:68