pem_export.h
Go to the documentation of this file.
1 /**
2  * @file pem_export.h
3  * @brief PEM file export functions
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2024 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.4.4
29  **/
30 
31 #ifndef _PEM_EXPORT_H
32 #define _PEM_EXPORT_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkix/pem_common.h"
37 #include "pkc/dh.h"
38 #include "pkc/rsa.h"
39 #include "pkc/dsa.h"
40 #include "ecc/ec.h"
41 #include "ecc/eddsa.h"
42 
43 //C++ guard
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 //PEM related functions
49 error_t pemExportCertificate(const uint8_t *cert, size_t certLen,
50  char_t *output, size_t *written);
51 
52 error_t pemExportCrl(const uint8_t *crl, size_t crlLen,
53  char_t *output, size_t *written);
54 
55 error_t pemExportCsr(const uint8_t *csr, size_t csrLen,
56  char_t *output, size_t *written);
57 
59  char_t *output, size_t *written);
60 
62  char_t *output, size_t *written);
63 
65  char_t *output, size_t *written);
66 
68  char_t *output, size_t *written);
69 
71  char_t *output, size_t *written);
72 
74  char_t *output, size_t *written);
75 
77  char_t *output, size_t *written);
78 
80  const EcPublicKey *publicKey, char_t *output, size_t *written);
81 
83  const EcPrivateKey *privateKey, const EcPublicKey *publicKey,
84  char_t *output, size_t *written);
85 
87  const EddsaPublicKey *publicKey, char_t *output, size_t *written);
88 
90  const EddsaPrivateKey *privateKey, char_t *output, size_t *written);
91 
92 //C++ guard
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif
error_t pemExportDsaPublicKey(const DsaPublicKey *publicKey, char_t *output, size_t *written)
Export a DSA public key to PEM format.
Definition: pem_export.c:469
error_t pemExportCsr(const uint8_t *csr, size_t csrLen, char_t *output, size_t *written)
Export a certification signing request to PEM format.
Definition: pem_export.c:123
error_t pemExportRsaPrivateKey(const RsaPrivateKey *privateKey, char_t *output, size_t *written)
Export an RSA private key to PEM format.
Definition: pem_export.c:208
error_t pemExportCertificate(const uint8_t *cert, size_t certLen, char_t *output, size_t *written)
Export an X.509 certificate to PEM format.
Definition: pem_export.c:57
PEM common definitions.
error_t pemExportEddsaPrivateKey(const EcCurveInfo *curveInfo, const EddsaPrivateKey *privateKey, char_t *output, size_t *written)
Export an EdDSA private key to PEM format.
Definition: pem_export.c:898
error_t pemExportEcPrivateKey(const EcCurveInfo *curveInfo, const EcPrivateKey *privateKey, const EcPublicKey *publicKey, char_t *output, size_t *written)
Export an EC private key to PEM format.
Definition: pem_export.c:736
Elliptic curve parameters.
Definition: ec_curves.h:302
Diffie-Hellman key exchange.
DSA public key.
Definition: dsa.h:61
error_t pemExportDsaPrivateKey(const DsaPrivateKey *privateKey, char_t *output, size_t *written)
Export a DSA private key to PEM format.
Definition: pem_export.c:522
error_t
Error codes.
Definition: error.h:43
EdDSA public key.
Definition: eddsa.h:49
RSA public key.
Definition: rsa.h:57
EdDSA (Edwards-Curve Digital Signature Algorithm)
General definitions for cryptographic algorithms.
RSA public-key cryptography standard.
DSA (Digital Signature Algorithm)
EC private key.
Definition: ec.h:104
DSA private key.
Definition: dsa.h:72
error_t pemExportRsaPublicKey(const RsaPublicKey *publicKey, char_t *output, size_t *written)
Export an RSA public key to PEM format.
Definition: pem_export.c:155
EdDSA private key.
Definition: eddsa.h:59
EC public key.
Definition: ec.h:94
char char_t
Definition: compiler_port.h:48
RSA private key.
Definition: rsa.h:68
error_t pemExportEddsaPublicKey(const EcCurveInfo *curveInfo, const EddsaPublicKey *publicKey, char_t *output, size_t *written)
Export an EdDSA public key to PEM format.
Definition: pem_export.c:844
error_t pemExportRsaPssPrivateKey(const RsaPrivateKey *privateKey, char_t *output, size_t *written)
Export an RSA-PSS private key to PEM format.
Definition: pem_export.c:365
error_t pemExportEcPublicKey(const EcCurveInfo *curveInfo, const EcPublicKey *publicKey, char_t *output, size_t *written)
Export an EC public key to PEM format.
Definition: pem_export.c:679
error_t pemExportCrl(const uint8_t *crl, size_t crlLen, char_t *output, size_t *written)
Export a certificate revocation list to PEM format.
Definition: pem_export.c:90
error_t pemExportRsaPssPublicKey(const RsaPublicKey *publicKey, char_t *output, size_t *written)
Export an RSA-PSS public key to PEM format.
Definition: pem_export.c:312
error_t pemExportEcParameters(const EcCurveInfo *curveInfo, char_t *output, size_t *written)
Export EC domain parameters to PEM format.
Definition: pem_export.c:627
ECC (Elliptic Curve Cryptography)