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 "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 | pkcs8ParseEncryptedPrivateKeyInfo (const uint8_t *data, size_t length, Pkcs8EncryptedPrivateKeyInfo *encryptedPrivateKeyInfo) |
Parse EncryptedPrivateKeyInfo structure. More... | |
error_t | pkcs8ParseEncryptionAlgoId (const uint8_t *data, size_t length, size_t *totalLength, X509AlgoId *encryptionAlgoId) |
Parse EncryptionAlgorithmIdentifier 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 a DSA private key. More... | |
error_t | pkcs8ImportEcPrivateKey (const Pkcs8PrivateKeyInfo *privateKeyInfo, EcPrivateKey *privateKey) |
Import an EC private key. More... | |
error_t | pkcs8ImportEddsaPrivateKey (const Pkcs8PrivateKeyInfo *privateKeyInfo, EddsaPrivateKey *privateKey) |
Import an EdDSA private key. More... | |
Detailed Description
PKCS #8 key parsing.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2010-2024 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.
- Version
- 2.4.4
Definition in file pkcs8_key_parse.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL CRYPTO_TRACE_LEVEL |
Definition at line 32 of file pkcs8_key_parse.c.
Function Documentation
◆ pkcs8ImportDsaPrivateKey()
error_t pkcs8ImportDsaPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
DsaPrivateKey * | privateKey | ||
) |
Import a DSA private key.
- Parameters
-
[in] privateKeyInfo Private key information [out] privateKey DSA private key
- Returns
- Error code
Definition at line 979 of file pkcs8_key_parse.c.
◆ pkcs8ImportEcPrivateKey()
error_t pkcs8ImportEcPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
EcPrivateKey * | privateKey | ||
) |
Import an EC private key.
- Parameters
-
[in] privateKeyInfo Private key information [out] privateKey EC private key
- Returns
- Error code
Definition at line 1064 of file pkcs8_key_parse.c.
◆ pkcs8ImportEddsaPrivateKey()
error_t pkcs8ImportEddsaPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
EddsaPrivateKey * | privateKey | ||
) |
Import an EdDSA private key.
- Parameters
-
[in] privateKeyInfo Private key information [out] privateKey EdDSA private key
- Returns
- Error code
Definition at line 1115 of file pkcs8_key_parse.c.
◆ pkcs8ImportRsaPrivateKey()
error_t pkcs8ImportRsaPrivateKey | ( | const Pkcs8PrivateKeyInfo * | privateKeyInfo, |
RsaPrivateKey * | privateKey | ||
) |
Import an RSA private key.
- Parameters
-
[in] privateKeyInfo Private key information [out] privateKey RSA private key
- Returns
- Error code
Definition at line 843 of file pkcs8_key_parse.c.
◆ pkcs8ParseDsaPrivateKey()
error_t pkcs8ParseDsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
X509DsaParameters * | dsaParams, | ||
Pkcs8DsaPrivateKey * | dsaPrivateKey | ||
) |
Parse DSAPrivateKey structure.
- Parameters
-
[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
- Returns
- Error code
Definition at line 490 of file pkcs8_key_parse.c.
◆ pkcs8ParseEcPrivateKey()
error_t pkcs8ParseEcPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
X509EcParameters * | ecParams, | ||
Pkcs8EcPrivateKey * | ecPrivateKey | ||
) |
Parse ECPrivateKey structure.
- Parameters
-
[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
- Returns
- Error code
Definition at line 631 of file pkcs8_key_parse.c.
◆ pkcs8ParseEddsaPrivateKey()
error_t pkcs8ParseEddsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
Pkcs8EddsaPrivateKey * | eddsaPrivateKey | ||
) |
Parse CurvePrivateKey structure.
- Parameters
-
[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
- Returns
- Error code
Definition at line 712 of file pkcs8_key_parse.c.
◆ pkcs8ParseEncryptedPrivateKeyInfo()
error_t pkcs8ParseEncryptedPrivateKeyInfo | ( | const uint8_t * | data, |
size_t | length, | ||
Pkcs8EncryptedPrivateKeyInfo * | encryptedPrivateKeyInfo | ||
) |
Parse EncryptedPrivateKeyInfo structure.
- Parameters
-
[in] data Pointer to the ASN.1 structure to parse [in] length Length of the ASN.1 structure [out] encryptedPrivateKeyInfo Information resulting from the parsing process
- Returns
- Error code
Definition at line 741 of file pkcs8_key_parse.c.
◆ pkcs8ParseEncryptionAlgoId()
error_t pkcs8ParseEncryptionAlgoId | ( | const uint8_t * | data, |
size_t | length, | ||
size_t * | totalLength, | ||
X509AlgoId * | encryptionAlgoId | ||
) |
Parse EncryptionAlgorithmIdentifier structure.
- Parameters
-
[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] encryptionAlgoId Information resulting from the parsing process
- Returns
- Error code
Definition at line 793 of file pkcs8_key_parse.c.
◆ pkcs8ParsePrivateKeyAlgo()
error_t pkcs8ParsePrivateKeyAlgo | ( | const uint8_t * | data, |
size_t | length, | ||
size_t * | totalLength, | ||
Pkcs8PrivateKeyInfo * | privateKeyInfo | ||
) |
Parse PrivateKeyAlgorithm structure.
- Parameters
-
[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
- Returns
- Error code
Definition at line 183 of file pkcs8_key_parse.c.
◆ pkcs8ParsePrivateKeyInfo()
error_t pkcs8ParsePrivateKeyInfo | ( | const uint8_t * | data, |
size_t | length, | ||
Pkcs8PrivateKeyInfo * | privateKeyInfo | ||
) |
Parse PrivateKeyInfo structure.
- Parameters
-
[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
- Returns
- Error code
Definition at line 54 of file pkcs8_key_parse.c.
◆ pkcs8ParseRsaPrivateKey()
error_t pkcs8ParseRsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
Pkcs8RsaPrivateKey * | rsaPrivateKey | ||
) |
Parse RSAPrivateKey structure.
- Parameters
-
[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
- Returns
- Error code
Definition at line 294 of file pkcs8_key_parse.c.