pkcs8_key_format.h File Reference

PKCS #8 key formatting. More...

#include "core/crypto.h"
#include "pkc/rsa.h"
#include "pkc/dsa.h"
#include "ecc/ec.h"
#include "ecc/eddsa.h"

Go to the source code of this file.

Functions

error_t pkcs8FormatRsaPrivateKey (const RsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 Format an RSA private key. More...
 
error_t pkcs8FormatDsaPrivateKey (const DsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 Format a DSA private key. More...
 
error_t pkcs8FormatEcPrivateKey (const EcCurveInfo *curveInfo, const EcPrivateKey *privateKey, const EcPublicKey *publicKey, uint8_t *output, size_t *written)
 Format an EC private key. More...
 
error_t pkcs8FormatEcPublicKey (const EcCurveInfo *curveInfo, const EcPublicKey *publicKey, uint8_t *output, size_t *written)
 Format an EC public key. More...
 
error_t pkcs8FormatEddsaPrivateKey (const EcCurveInfo *curveInfo, const EddsaPrivateKey *privateKey, uint8_t *output, size_t *written)
 Format an EdDSA private key. More...
 

Detailed Description

PKCS #8 key formatting.

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.

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

Definition in file pkcs8_key_format.h.

Function Documentation

◆ pkcs8FormatDsaPrivateKey()

error_t pkcs8FormatDsaPrivateKey ( const DsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

Format a DSA private key.

Parameters
[in]privateKeyPointer to the RSA private key
[out]outputBuffer where to store the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 96 of file pkcs8_key_format.c.

◆ pkcs8FormatEcPrivateKey()

error_t pkcs8FormatEcPrivateKey ( const EcCurveInfo curveInfo,
const EcPrivateKey privateKey,
const EcPublicKey publicKey,
uint8_t *  output,
size_t *  written 
)

Format an EC private key.

Parameters
[in]curveInfoElliptic curve parameters
[in]privateKeyEC private key
[in]publicKeyEC public key (optional parameter)
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 140 of file pkcs8_key_format.c.

◆ pkcs8FormatEcPublicKey()

error_t pkcs8FormatEcPublicKey ( const EcCurveInfo curveInfo,
const EcPublicKey publicKey,
uint8_t *  output,
size_t *  written 
)

Format an EC public key.

Parameters
[in]curveInfoElliptic curve parameters
[in]publicKeyEC public key
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 263 of file pkcs8_key_format.c.

◆ pkcs8FormatEddsaPrivateKey()

error_t pkcs8FormatEddsaPrivateKey ( const EcCurveInfo curveInfo,
const EddsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

Format an EdDSA private key.

Parameters
[in]curveInfoElliptic curve parameters
[in]privateKeyEdDSA private key
[out]outputBuffer where to format the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 338 of file pkcs8_key_format.c.

◆ pkcs8FormatRsaPrivateKey()

error_t pkcs8FormatRsaPrivateKey ( const RsaPrivateKey privateKey,
uint8_t *  output,
size_t *  written 
)

Format an RSA private key.

Parameters
[in]privateKeyPointer to the RSA private key
[out]outputBuffer where to store the ASN.1 structure
[out]writtenLength of the resulting ASN.1 structure
Returns
Error code

Definition at line 54 of file pkcs8_key_format.c.