PKCS #8 key parsing. More...
#include "core/crypto.h"
#include "pkix/pkcs8_key_parse.h"
#include "pkix/x509_key_parse.h"
#include "encoding/asn1.h"
#include "encoding/oid.h"
#include "ecc/ed25519.h"
#include "ecc/ed448.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Functions | |
error_t | pkcs8ParsePrivateKeyInfo (const uint8_t *data, size_t length, Pkcs8PrivateKeyInfo *privateKeyInfo) |
Parse PrivateKeyInfo structure. More... | |
error_t | pkcs8ParsePrivateKeyAlgo (const uint8_t *data, size_t length, size_t *totalLength, Pkcs8PrivateKeyInfo *privateKeyInfo) |
Parse PrivateKeyAlgorithm structure. More... | |
error_t | pkcs8ParseRsaPrivateKey (const uint8_t *data, size_t length, Pkcs8RsaPrivateKey *rsaPrivateKey) |
Parse RSAPrivateKey structure. More... | |
error_t | pkcs8ParseDsaPrivateKey (const uint8_t *data, size_t length, X509DsaParameters *dsaParams, Pkcs8DsaPrivateKey *dsaPrivateKey) |
Parse DSAPrivateKey structure. More... | |
error_t | pkcs8ParseEcPrivateKey (const uint8_t *data, size_t length, X509EcParameters *ecParams, Pkcs8EcPrivateKey *ecPrivateKey) |
Parse ECPrivateKey structure. More... | |
error_t | pkcs8ParseEddsaPrivateKey (const uint8_t *data, size_t length, Pkcs8EddsaPrivateKey *eddsaPrivateKey) |
Parse CurvePrivateKey structure. More... | |
error_t | pkcs8ImportRsaPrivateKey (const Pkcs8PrivateKeyInfo *privateKeyInfo, RsaPrivateKey *privateKey) |
Import an RSA private key. More... | |
error_t | pkcs8ImportDsaPrivateKey (const Pkcs8PrivateKeyInfo *privateKeyInfo, DsaPrivateKey *privateKey) |
Import an DSA private key. More... | |
error_t | pkcs8ImportEcPrivateKey (const Pkcs8PrivateKeyInfo *privateKeyInfo, Mpi *privateKey) |
Import an EC private key. More... | |
error_t | pkcs8ImportEddsaPrivateKey (const Pkcs8PrivateKeyInfo *privateKeyInfo, EddsaPrivateKey *privateKey) |
Import an EdDSA private key. More... | |
PKCS #8 key parsing.
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2019 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.
Definition in file pkcs8_key_parse.c.
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file pkcs8_key_parse.c.
error_t pkcs8ImportDsaPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
DsaPrivateKey * | privateKey | ||
) |
Import an DSA private key.
[in] | privateKeyInfo | Private key information |
[out] | privateKey | DSA private key |
Definition at line 878 of file pkcs8_key_parse.c.
error_t pkcs8ImportEcPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
Mpi * | privateKey | ||
) |
Import an EC private key.
[in] | privateKeyInfo | Private key information |
[out] | privateKey | EC private key |
Definition at line 963 of file pkcs8_key_parse.c.
error_t pkcs8ImportEddsaPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
EddsaPrivateKey * | privateKey | ||
) |
Import an EdDSA private key.
[in] | privateKeyInfo | Private key information |
[out] | privateKey | EdDSA private key |
Definition at line 1014 of file pkcs8_key_parse.c.
error_t pkcs8ImportRsaPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
RsaPrivateKey * | privateKey | ||
) |
Import an RSA private key.
[in] | privateKeyInfo | Private key information |
[out] | privateKey | RSA private key |
Definition at line 742 of file pkcs8_key_parse.c.
error_t pkcs8ParseDsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
X509DsaParameters * | dsaParams, | ||
Pkcs8DsaPrivateKey * | dsaPrivateKey | ||
) |
Parse DSAPrivateKey structure.
[in] | data | Pointer to the ASN.1 structure to parse |
[in] | length | Length of the ASN.1 structure |
[out] | dsaParams | DSA domain parameters |
[out] | dsaPrivateKey | DSA private key |
Definition at line 492 of file pkcs8_key_parse.c.
error_t pkcs8ParseEcPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
X509EcParameters * | ecParams, | ||
Pkcs8EcPrivateKey * | ecPrivateKey | ||
) |
Parse ECPrivateKey structure.
[in] | data | Pointer to the ASN.1 structure to parse |
[in] | length | Length of the ASN.1 structure |
[out] | ecParams | EC domain parameters |
[out] | ecPrivateKey | EC private key |
Definition at line 633 of file pkcs8_key_parse.c.
error_t pkcs8ParseEddsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
Pkcs8EddsaPrivateKey * | eddsaPrivateKey | ||
) |
Parse CurvePrivateKey structure.
[in] | data | Pointer to the ASN.1 structure to parse |
[in] | length | Length of the ASN.1 structure |
[out] | eddsaPrivateKey | Information resulting from the parsing process |
Definition at line 714 of file pkcs8_key_parse.c.
error_t pkcs8ParsePrivateKeyAlgo | ( | const uint8_t * | data, |
size_t | length, | ||
size_t * | totalLength, | ||
Pkcs8PrivateKeyInfo * | privateKeyInfo | ||
) |
Parse PrivateKeyAlgorithm structure.
[in] | data | Pointer to the ASN.1 structure to parse |
[in] | length | Length of the ASN.1 structure |
[out] | totalLength | Number of bytes that have been parsed |
[out] | privateKeyInfo | Information resulting from the parsing process |
Definition at line 185 of file pkcs8_key_parse.c.
error_t pkcs8ParsePrivateKeyInfo | ( | const uint8_t * | data, |
size_t | length, | ||
Pkcs8PrivateKeyInfo * | privateKeyInfo | ||
) |
Parse PrivateKeyInfo structure.
[in] | data | Pointer to the ASN.1 structure to parse |
[in] | length | Length of the ASN.1 structure |
[out] | privateKeyInfo | Information resulting from the parsing process |
Definition at line 56 of file pkcs8_key_parse.c.
error_t pkcs8ParseRsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
Pkcs8RsaPrivateKey * | rsaPrivateKey | ||
) |
Parse RSAPrivateKey structure.
[in] | data | Pointer to the ASN.1 structure to parse |
[in] | length | Length of the ASN.1 structure |
[out] | rsaPrivateKey | Information resulting from the parsing process |
Definition at line 296 of file pkcs8_key_parse.c.