pem_key_import.h
Go to the documentation of this file.
1 /**
2  * @file pem_key_import.h
3  * @brief PEM key file import functions
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2026 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.6.4
29  **/
30 
31 #ifndef _PEM_KEY_IMPORT_H
32 #define _PEM_KEY_IMPORT_H
33 
34 //Dependencies
35 #include "core/crypto.h"
36 #include "pkix/pem_common.h"
37 #include "pkix/x509_common.h"
38 
39 //C++ guard
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 //PEM related functions
45 error_t pemImportRsaPublicKey(RsaPublicKey *publicKey, const char_t *input,
46  size_t length);
47 
48 error_t pemImportRsaPrivateKey(RsaPrivateKey *privateKey, const char_t *input,
49  size_t length, const char_t *password);
50 
51 error_t pemImportDsaPublicKey(DsaPublicKey *publicKey, const char_t *input,
52  size_t length);
53 
54 error_t pemImportDsaPrivateKey(DsaPrivateKey *privateKey, const char_t *input,
55  size_t length, const char_t *password);
56 
57 error_t pemImportEcPublicKey(EcPublicKey *publicKey, const char_t *input,
58  size_t length);
59 
60 error_t pemImportEcPrivateKey(EcPrivateKey *privateKey, const char_t *input,
61  size_t length, const char_t *password);
62 
63 error_t pemImportEddsaPublicKey(EddsaPublicKey *publicKey, const char_t *input,
64  size_t length);
65 
67  const char_t *input, size_t length, const char_t *password);
68 
69 error_t pemImportMldsaPublicKey(MldsaPublicKey *publicKey, const char_t *input,
70  size_t length);
71 
73  const char_t *input, size_t length, const char_t *password);
74 
75 X509KeyType pemGetPublicKeyType(const char_t *input, size_t length);
76 const EcCurve *pemGetPublicKeyCurve(const char_t *input, size_t length);
77 
78 //C++ guard
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif
X.509 common definitions.
error_t pemImportEcPublicKey(EcPublicKey *publicKey, const char_t *input, size_t length)
Decode a PEM file containing an EC public key.
error_t pemImportDsaPrivateKey(DsaPrivateKey *privateKey, const char_t *input, size_t length, const char_t *password)
Decode a PEM file containing a DSA private key.
const EcCurve * pemGetPublicKeyCurve(const char_t *input, size_t length)
Extract elliptic curve parameters from a PEM file.
PEM common definitions.
error_t pemImportDsaPublicKey(DsaPublicKey *publicKey, const char_t *input, size_t length)
Decode a PEM file containing a DSA public key.
error_t pemImportMldsaPrivateKey(MldsaPrivateKey *privateKey, const char_t *input, size_t length, const char_t *password)
Decode a PEM file containing a ML-DSA private key.
ML-DSA public key.
Definition: mldsa.h:82
DSA public key.
Definition: dsa.h:61
error_t
Error codes.
Definition: error.h:43
EdDSA public key.
Definition: eddsa.h:64
error_t pemImportEddsaPrivateKey(EddsaPrivateKey *privateKey, const char_t *input, size_t length, const char_t *password)
Decode a PEM file containing a EdDSA private key.
RSA public key.
Definition: rsa.h:57
error_t pemImportRsaPrivateKey(RsaPrivateKey *privateKey, const char_t *input, size_t length, const char_t *password)
Decode a PEM file containing an RSA private key.
General definitions for cryptographic algorithms.
EC private key.
Definition: ec.h:432
DSA private key.
Definition: dsa.h:72
uint8_t length
Definition: tcp.h:375
error_t pemImportEcPrivateKey(EcPrivateKey *privateKey, const char_t *input, size_t length, const char_t *password)
Decode a PEM file containing an EC private key.
error_t pemImportMldsaPublicKey(MldsaPublicKey *publicKey, const char_t *input, size_t length)
Decode a PEM file containing a ML-DSA public key.
EdDSA private key.
Definition: eddsa.h:75
EC public key.
Definition: ec.h:421
char char_t
Definition: compiler_port.h:55
RSA private key.
Definition: rsa.h:68
error_t pemImportEddsaPublicKey(EddsaPublicKey *publicKey, const char_t *input, size_t length)
Decode a PEM file containing a EdDSA public key.
ML-DSA private key.
Definition: mldsa.h:94
X509KeyType pemGetPublicKeyType(const char_t *input, size_t length)
Extract the public key type from a PEM file.
#define EcCurve
Definition: ec.h:346
error_t pemImportRsaPublicKey(RsaPublicKey *publicKey, const char_t *input, size_t length)
Decode a PEM file containing an RSA public key.
X509KeyType
Public Key types.
Definition: x509_common.h:657