x509_key_format.h
Go to the documentation of this file.
1 /**
2  * @file x509_key_format.h
3  * @brief Formatting of ASN.1 encoded keys
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 _X509_KEY_FORMAT_H
32 #define _X509_KEY_FORMAT_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkix/x509_common.h"
37 
38 //C++ guard
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 //Key formatting functions
45  const void *publicKey, uint8_t *keyId, uint8_t *output, size_t *written);
46 
48  const void *params, uint8_t *output, size_t *written);
49 
51  uint8_t *output, size_t *written);
52 
54  uint8_t *output, size_t *written);
55 
57  uint8_t *output, size_t *written);
58 
60  uint8_t *output, size_t *written);
61 
63  uint8_t *output, size_t *written);
64 
66  uint8_t *output, size_t *written);
67 
69  uint8_t *output, size_t *written);
70 
72  uint8_t *output, size_t *written);
73 
75  uint8_t *output, size_t *written);
76 
78  uint8_t *output, size_t *written);
79 
81  const EcPoint *publicKey, uint8_t *output, size_t *written);
82 
84  size_t publicKeyLen, uint8_t *output, size_t *written);
85 
87  size_t privateKeyLen, uint8_t *output, size_t *written);
88 
89 //C++ guard
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif
X.509 common definitions.
error_t x509ExportDsaPrivateKey(const DsaPrivateKey *privateKey, uint8_t *output, size_t *written)
Export a DSA private key to ASN.1 format.
error_t x509ExportRsaPrivateKey(const RsaPrivateKey *privateKey, uint8_t *output, size_t *written)
Export an RSA private key to ASN.1 format.
error_t x509FormatAlgoId(const X509SubjectPublicKeyInfo *publicKeyInfo, const void *params, uint8_t *output, size_t *written)
Format AlgorithmIdentifier structure.
error_t x509ExportDsaPublicKey(const DsaPublicKey *publicKey, uint8_t *output, size_t *written)
Export a DSA public key to ASN.1 format.
EC public key.
Definition: x509_common.h:780
error_t x509ExportEddsaPrivateKey(const EddsaPrivateKey *privateKey, size_t privateKeyLen, uint8_t *output, size_t *written)
Export an EdDSA private key to ASN.1 format.
error_t x509FormatSubjectPublicKeyInfo(const X509SubjectPublicKeyInfo *publicKeyInfo, const void *publicKey, uint8_t *keyId, uint8_t *output, size_t *written)
Format SubjectPublicKeyInfo structure.
DSA public key.
Definition: dsa.h:61
error_t x509ExportEcPublicKey(const X509SubjectPublicKeyInfo *publicKeyInfo, const EcPoint *publicKey, uint8_t *output, size_t *written)
Export an EC public key to ASN.1 format.
error_t
Error codes.
Definition: error.h:43
EC parameters.
Definition: x509_common.h:770
error_t x509ExportRsaPublicKey(const RsaPublicKey *publicKey, uint8_t *output, size_t *written)
Export an RSA public key to ASN.1 format.
EdDSA public key.
Definition: eddsa.h:49
RSA public key.
Definition: x509_common.h:737
error_t x509FormatEcPublicKey(const X509EcPublicKey *ecPublicKey, uint8_t *output, size_t *written)
Format ECPublicKey structure.
error_t x509FormatEcParameters(const X509EcParameters *ecParams, uint8_t *output, size_t *written)
Format ECParameters structure.
RSA public key.
Definition: rsa.h:57
DSA domain parameters.
Definition: dsa.h:49
General definitions for cryptographic algorithms.
error_t x509FormatDsaPublicKey(const X509DsaPublicKey *dsaPublicKey, uint8_t *output, size_t *written)
Format DSAPublicKey structure.
DSA private key.
Definition: dsa.h:72
error_t x509FormatRsaPublicKey(const X509RsaPublicKey *rsaPublicKey, uint8_t *output, size_t *written)
Format RSAPublicKey structure.
EC point.
Definition: ec.h:64
EdDSA private key.
Definition: eddsa.h:59
error_t x509ExportDsaParameters(const DsaDomainParameters *params, uint8_t *output, size_t *written)
Export DSA domain parameters to ASN.1 format.
RSA private key.
Definition: rsa.h:68
Subject Public Key Information extension.
Definition: x509_common.h:790
DSA domain parameters.
Definition: x509_common.h:748
error_t x509ExportEddsaPublicKey(const EddsaPublicKey *publicKey, size_t publicKeyLen, uint8_t *output, size_t *written)
Export an EdDSA public key to ASN.1 format.
error_t x509FormatDsaParameters(const X509DsaParameters *dsaParams, uint8_t *output, size_t *written)
Format DSA domain parameters.
DSA public key.
Definition: x509_common.h:760