pem_import.h
Go to the documentation of this file.
1 /**
2  * @file pem_import.h
3  * @brief PEM file import functions
4  *
5  * @section License
6  *
7  * Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.
8  *
9  * This file is part of CycloneCrypto Open.
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software Foundation,
23  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24  *
25  * @author Oryx Embedded SARL (www.oryx-embedded.com)
26  * @version 1.9.0
27  **/
28 
29 #ifndef _PEM_IMPORT_H
30 #define _PEM_IMPORT_H
31 
32 //Dependencies
33 #include "core/crypto.h"
34 #include "pkc/dh.h"
35 #include "pkc/rsa.h"
36 #include "pkc/dsa.h"
37 #include "ecc/ec.h"
38 #include "ecc/eddsa.h"
39 
40 //C++ guard
41 #ifdef __cplusplus
42  extern "C" {
43 #endif
44 
45 //PEM format decoding functions
46 error_t pemImportDhParameters(const char_t *input, size_t length, DhParameters *params);
47 
48 error_t pemImportRsaPrivateKey(const char_t *input, size_t length, RsaPrivateKey *key);
49 error_t pemImportDsaPrivateKey(const char_t *input, size_t length, DsaPrivateKey *key);
50 
51 error_t pemImportEcParameters(const char_t *input, size_t length, EcDomainParameters *params);
52 error_t pemImportEcPrivateKey(const char_t *input, size_t length, Mpi *key);
53 
55 
56 error_t pemImportCertificate(const char_t **input, size_t *inputLen,
57  uint8_t **output, size_t *outputSize, size_t *outputLen);
58 
59 int_t pemSearchTag(const char_t *s, size_t sLen, const char_t *tag, size_t tagLen);
60 
61 //C++ guard
62 #ifdef __cplusplus
63  }
64 #endif
65 
66 #endif
ECC (Elliptic Curve Cryptography)
EC domain parameters.
Definition: ec.h:61
Arbitrary precision integer.
Definition: mpi.h:67
char char_t
Definition: compiler_port.h:41
error_t pemImportRsaPrivateKey(const char_t *input, size_t length, RsaPrivateKey *key)
Decode a PEM file containing a RSA private key.
Definition: pem_import.c:211
int_t pemSearchTag(const char_t *s, size_t sLen, const char_t *tag, size_t tagLen)
Search a string for a given tag.
Definition: pem_import.c:1800
General definitions for cryptographic algorithms.
error_t pemImportEcParameters(const char_t *input, size_t length, EcDomainParameters *params)
Decode a PEM file containing EC domain parameters.
Definition: pem_import.c:1012
signed int int_t
Definition: compiler_port.h:42
Diffie-Hellman key exchange.
EdDSA (Edwards-Curve Digital Signature Algorithm)
EdDSA private key.
Definition: eddsa.h:56
DSA (Digital Signature Algorithm)
error_t pemImportDhParameters(const char_t *input, size_t length, DhParameters *params)
Decode a PEM file containing Diffie-Hellman parameters.
Definition: pem_import.c:53
error_t pemImportEddsaPrivateKey(const char_t *input, size_t length, EddsaPrivateKey *key)
Decode a PEM file containing a EdDSA private key.
Definition: pem_import.c:1485
error_t
Error codes.
Definition: error.h:40
RSA public-key cryptography standard.
DSA private key.
Definition: dsa.h:59
error_t pemImportDsaPrivateKey(const char_t *input, size_t length, DsaPrivateKey *key)
Decode a PEM file containing a DSA private key.
Definition: pem_import.c:637
error_t pemImportCertificate(const char_t **input, size_t *inputLen, uint8_t **output, size_t *outputSize, size_t *outputLen)
Decode a PEM file containing a certificate.
Definition: pem_import.c:1687
uint8_t length
Definition: dtls_misc.h:140
RSA private key.
Definition: rsa.h:57
Diffie-Hellman parameters.
Definition: dh.h:46
error_t pemImportEcPrivateKey(const char_t *input, size_t length, Mpi *key)
Decode a PEM file containing an EC private key.
Definition: pem_import.c:1231