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-2025 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.5.2
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 #include "pkc/rsa.h"
39 #include "pkc/dsa.h"
40 #include "ecc/ec.h"
41 #include "ecc/eddsa.h"
42 
43 //C++ guard
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 //PEM related functions
49 error_t pemImportRsaPublicKey(RsaPublicKey *publicKey, const char_t *input,
50  size_t length);
51 
52 error_t pemImportRsaPrivateKey(RsaPrivateKey *privateKey, const char_t *input,
53  size_t length, const char_t *password);
54 
55 error_t pemImportDsaPublicKey(DsaPublicKey *publicKey, const char_t *input,
56  size_t length);
57 
58 error_t pemImportDsaPrivateKey(DsaPrivateKey *privateKey, const char_t *input,
59  size_t length, const char_t *password);
60 
61 error_t pemImportEcPublicKey(EcPublicKey *publicKey, const char_t *input,
62  size_t length);
63 
64 error_t pemImportEcPrivateKey(EcPrivateKey *privateKey, const char_t *input,
65  size_t length, const char_t *password);
66 
67 error_t pemImportEddsaPublicKey(EddsaPublicKey *publicKey, const char_t *input,
68  size_t length);
69 
71  const char_t *input, size_t length, const char_t *password);
72 
73 X509KeyType pemGetPublicKeyType(const char_t *input, size_t length);
74 const EcCurve *pemGetPublicKeyCurve(const char_t *input, size_t length);
75 
76 //C++ guard
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #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.
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
EdDSA (Edwards-Curve Digital Signature Algorithm)
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.
RSA public-key cryptography standard.
DSA (Digital Signature Algorithm)
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.
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.
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:633
ECC (Elliptic Curve Cryptography)