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-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 _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  uint8_t *output, size_t *written);
82 
84  uint8_t *output, size_t *written);
85 
87  uint8_t *output, size_t *written);
88 
90  uint8_t *output, size_t *written);
91 
93  uint8_t *output, size_t *written);
94 
96  const EcPoint *publicKey, uint8_t *output, size_t *written);
97 
99  size_t publicKeyLen, uint8_t *output, size_t *written);
100 
102  size_t privateKeyLen, uint8_t *output, size_t *written);
103 
104 //C++ guard
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif
X.509 common definitions.
error_t x509FormatRsaPssParameters(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS parameters.
error_t x509FormatRsaPssMaskGenAlgo(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS mask generation algorithm.
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.
uint32_t keyId
Definition: ntp_common.h:172
error_t x509FormatRsaPssMaskGenHashAlgo(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS mask generation hash algorithm.
error_t x509FormatAlgorithmIdentifier(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:683
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:60
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:42
EC parameters.
Definition: x509_common.h:672
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:48
RSA public key.
Definition: x509_common.h:633
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:48
DSA domain parameters.
Definition: dsa.h:48
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:73
error_t x509FormatRsaPssHashAlgo(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS hash algorithm.
error_t x509FormatRsaPublicKey(const X509RsaPublicKey *rsaPublicKey, uint8_t *output, size_t *written)
Format RSAPublicKey structure.
Elliptic curve point.
Definition: ec.h:51
error_t x509FormatRsaPssSaltLength(const X509RsaPssParameters *rsaPssParams, uint8_t *output, size_t *written)
Format RSASSA-PSS salt length.
EdDSA private key.
Definition: eddsa.h:58
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:59
Subject public key information.
Definition: x509_common.h:694
DSA domain parameters.
Definition: x509_common.h:646
RSASSA-PSS parameters.
Definition: x509_common.h:860
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:661