pem_import.c File Reference

PEM file import functions. More...

#include "core/crypto.h"
#include "certificate/pem_import.h"
#include "encoding/asn1.h"
#include "encoding/oid.h"
#include "encoding/base64.h"
#include "mpi/mpi.h"
#include "debug.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

error_t pemImportDhParameters (const char_t *input, size_t length, DhParameters *params)
 Decode a PEM file containing Diffie-Hellman parameters. More...
 
error_t pemImportRsaPrivateKey (const char_t *input, size_t length, RsaPrivateKey *key)
 Decode a PEM file containing a RSA private key. More...
 
error_t pemImportDsaPrivateKey (const char_t *input, size_t length, DsaPrivateKey *key)
 Decode a PEM file containing a DSA private key. More...
 
error_t pemImportEcParameters (const char_t *input, size_t length, EcDomainParameters *params)
 Decode a PEM file containing EC domain parameters. More...
 
error_t pemImportEcPrivateKey (const char_t *input, size_t length, Mpi *key)
 Decode a PEM file containing an EC private key. More...
 
error_t pemImportEddsaPrivateKey (const char_t *input, size_t length, EddsaPrivateKey *key)
 Decode a PEM file containing a EdDSA private key. More...
 
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. More...
 
int_t pemSearchTag (const char_t *s, size_t sLen, const char_t *tag, size_t tagLen)
 Search a string for a given tag. More...
 

Detailed Description

PEM file import functions.

License

Copyright (C) 2010-2018 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCrypto Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
1.9.0

Definition in file pem_import.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 30 of file pem_import.c.

Function Documentation

◆ pemImportCertificate()

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.

Parameters
[in,out]inputPointer to the PEM structure
[in,out]inputLenLength of the PEM structure
[in,out]outputPointer to the DER encoded certificate
[in,out]outputSizeSize of the memory block that holds the DER certificate
[out]outputLenLength of the DER encoded certificate
Returns
Error code

Definition at line 1687 of file pem_import.c.

◆ pemImportDhParameters()

error_t pemImportDhParameters ( const char_t input,
size_t  length,
DhParameters params 
)

Decode a PEM file containing Diffie-Hellman parameters.

Parameters
[in]inputPointer to the PEM structure
[in]lengthLength of the PEM structure
[out]paramsDiffie-Hellman parameters resulting from the parsing process
Returns
Error code

Definition at line 53 of file pem_import.c.

◆ pemImportDsaPrivateKey()

error_t pemImportDsaPrivateKey ( const char_t input,
size_t  length,
DsaPrivateKey key 
)

Decode a PEM file containing a DSA private key.

Parameters
[in]inputPointer to the PEM structure
[in]lengthLength of the PEM structure
[out]keyDSA private key resulting from the parsing process
Returns
Error code

Definition at line 637 of file pem_import.c.

◆ pemImportEcParameters()

error_t pemImportEcParameters ( const char_t input,
size_t  length,
EcDomainParameters params 
)

Decode a PEM file containing EC domain parameters.

Parameters
[in]inputPointer to the PEM structure
[in]lengthLength of the PEM structure
[out]paramsEC domain parameters
Returns
Error code

Definition at line 1012 of file pem_import.c.

◆ pemImportEcPrivateKey()

error_t pemImportEcPrivateKey ( const char_t input,
size_t  length,
Mpi key 
)

Decode a PEM file containing an EC private key.

Parameters
[in]inputPointer to the PEM structure
[in]lengthLength of the PEM structure
[out]keyEC private key resulting from the parsing process
Returns
Error code

Definition at line 1231 of file pem_import.c.

◆ pemImportEddsaPrivateKey()

error_t pemImportEddsaPrivateKey ( const char_t input,
size_t  length,
EddsaPrivateKey key 
)

Decode a PEM file containing a EdDSA private key.

Parameters
[in]inputPointer to the PEM structure
[in]lengthLength of the PEM structure
[out]keyEdDSA private key resulting from the parsing process
Returns
Error code

Definition at line 1485 of file pem_import.c.

◆ pemImportRsaPrivateKey()

error_t pemImportRsaPrivateKey ( const char_t input,
size_t  length,
RsaPrivateKey key 
)

Decode a PEM file containing a RSA private key.

Parameters
[in]inputPointer to the PEM structure
[in]lengthLength of the PEM structure
[out]keyRSA private key resulting from the parsing process
Returns
Error code

Definition at line 211 of file pem_import.c.

◆ pemSearchTag()

int_t pemSearchTag ( const char_t s,
size_t  sLen,
const char_t tag,
size_t  tagLen 
)

Search a string for a given tag.

Parameters
[in]sString to search
[in]sLenLength of the string to search
[in]tagString containing the tag to search for
[in]tagLenLength of the tag
Returns
The index of the first occurrence of the tag in the string, or -1 if the tag does not appear in the string

Definition at line 1800 of file pem_import.c.