1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CF_X509CSR_H 17 #define CF_X509CSR_H 18 19 #include "cf_blob.h" 20 #include "x509_distinguished_name.h" 21 22 typedef struct HcfAttributes HcfAttributes; 23 struct HcfAttributes { 24 /** Name of the attribute (e.g., "challengePassword") */ 25 char *attributeName; 26 /** Value of the attribute */ 27 char *attributeValue; 28 }; 29 30 typedef struct { 31 HcfAttributes *array; 32 uint32_t attributeSize; 33 } HcfAttributesArray; 34 35 typedef struct HcfGenCsrConf HcfGenCsrConf; 36 struct HcfGenCsrConf { 37 /** Subject information for the CSR */ 38 HcfX509DistinguishedName *subject; 39 /** Additional attributes to be included in the CSR */ 40 HcfAttributesArray attribute; 41 /** Message digest algorithm name (e.g., "SHA256", "SHA512") */ 42 char *mdName; 43 /** Flag to indicate if the output format should be PEM (true) or DER (false) */ 44 bool isPem; 45 }; 46 47 48 #ifdef __cplusplus 49 extern "C" { 50 #endif 51 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 #endif // CF_X509CRL_H