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-2019 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 1.9.6
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 Mpi *privateKey, const EcPoint *publicKey, uint8_t *output,
55  size_t *written);
56 
58  const EcPoint *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
Arbitrary precision integer.
Definition: mpi.h:69
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:292
error_t
Error codes.
Definition: error.h:42
EdDSA (Edwards-Curve Digital Signature Algorithm)
General definitions for cryptographic algorithms.
RSA public-key cryptography standard.
DSA (Digital Signature Algorithm)
DSA private key.
Definition: dsa.h:73
Elliptic curve point.
Definition: ec.h:51
error_t pkcs8FormatDsaPrivateKey(const DsaPrivateKey *privateKey, uint8_t *output, size_t *written)
Format a DSA private key.
EdDSA private key.
Definition: eddsa.h:58
error_t pkcs8FormatEcPrivateKey(const EcCurveInfo *curveInfo, const Mpi *privateKey, const EcPoint *publicKey, uint8_t *output, size_t *written)
Format an EC private key.
RSA private key.
Definition: rsa.h:59
error_t pkcs8FormatRsaPrivateKey(const RsaPrivateKey *privateKey, uint8_t *output, size_t *written)
Format an RSA private key.
error_t pkcs8FormatEcPublicKey(const EcCurveInfo *curveInfo, const EcPoint *publicKey, uint8_t *output, size_t *written)
Format an EC public key.
ECC (Elliptic Curve Cryptography)