pkcs8_key_format.h
Go to the documentation of this file.
1 /**
2  * @file pkcs8_key_format.h
3  * @brief PKCS #8 key formatting
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 _PKCS8_KEY_FORMAT_H
32 #define _PKCS8_KEY_FORMAT_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkc/rsa.h"
37 #include "pkc/dsa.h"
38 #include "ecc/ec.h"
39 #include "ecc/eddsa.h"
40 
41 //C++ guard
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 //Key formatting functions
48  uint8_t *output, size_t *written);
49 
51  uint8_t *output, size_t *written);
52 
54  const EcPrivateKey *privateKey, const EcPublicKey *publicKey,
55  uint8_t *output, size_t *written);
56 
58  const EcPublicKey *publicKey, uint8_t *output, size_t *written);
59 
61  const EddsaPrivateKey *privateKey, uint8_t *output, size_t *written);
62 
63 //C++ guard
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif
error_t pkcs8FormatEcPrivateKey(const EcCurveInfo *curveInfo, const EcPrivateKey *privateKey, const EcPublicKey *publicKey, uint8_t *output, size_t *written)
Format an EC private key.
error_t pkcs8FormatEddsaPrivateKey(const EcCurveInfo *curveInfo, const EddsaPrivateKey *privateKey, uint8_t *output, size_t *written)
Format an EdDSA private key.
Elliptic curve parameters.
Definition: ec_curves.h:302
error_t
Error codes.
Definition: error.h:43
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 pkcs8FormatDsaPrivateKey(const DsaPrivateKey *privateKey, uint8_t *output, size_t *written)
Format a DSA private key.
EdDSA private key.
Definition: eddsa.h:59
EC public key.
Definition: ec.h:94
RSA private key.
Definition: rsa.h:68
error_t pkcs8FormatRsaPrivateKey(const RsaPrivateKey *privateKey, uint8_t *output, size_t *written)
Format an RSA private key.
error_t pkcs8FormatEcPublicKey(const EcCurveInfo *curveInfo, const EcPublicKey *publicKey, uint8_t *output, size_t *written)
Format an EC public key.
ECC (Elliptic Curve Cryptography)