SSH key formatting. More...
#include "ssh/ssh.h"
#include "ssh/ssh_key_parse.h"
#include "ssh/ssh_key_format.h"
#include "ssh/ssh_misc.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL SSH_TRACE_LEVEL |
Functions | |
error_t | sshFormatRsaPublicKey (const RsaPublicKey *publicKey, uint8_t *p, size_t *written) |
Format an RSA public host key. More... | |
error_t | sshFormatDsaPublicKey (const DsaPublicKey *publicKey, uint8_t *p, size_t *written) |
Format a DSA public host key. More... | |
error_t | sshFormatEcdsaPublicKey (const EcDomainParameters *params, const EcPublicKey *publicKey, uint8_t *p, size_t *written) |
Format an ECDSA public host key. More... | |
error_t | sshFormatEd25519PublicKey (const EddsaPublicKey *publicKey, uint8_t *p, size_t *written) |
Format an Ed25519 public host key. More... | |
error_t | sshFormatEd448PublicKey (const EddsaPublicKey *publicKey, uint8_t *p, size_t *written) |
Format an Ed448 public host key. More... | |
error_t | sshFormatOpenSshPrivateKeyHeader (uint8_t *p, size_t *written) |
Format private key header (OpenSSH format) More... | |
error_t | sshFormatOpenSshRsaPrivateKey (const RsaPrivateKey *privateKey, uint8_t *p, size_t *written) |
Format RSA private key blob (OpenSSH format) More... | |
error_t | sshFormatOpenSshDsaPrivateKey (const DsaPrivateKey *privateKey, const DsaPublicKey *publicKey, uint8_t *p, size_t *written) |
Format DSA private key blob (OpenSSH format) More... | |
error_t | sshFormatOpenSshEcdsaPrivateKey (const EcDomainParameters *params, const EcPrivateKey *privateKey, const EcPublicKey *publicKey, uint8_t *p, size_t *written) |
Format ECDSA private key blob (OpenSSH format) More... | |
error_t | sshFormatOpenSshEd25519PrivateKey (const EddsaPrivateKey *privateKey, const EddsaPublicKey *publicKey, uint8_t *p, size_t *written) |
Format Ed25519 private key blob (OpenSSH format) More... | |
error_t | sshFormatOpenSshEd448PrivateKey (const EddsaPrivateKey *privateKey, const EddsaPublicKey *publicKey, uint8_t *p, size_t *written) |
Format Ed448 private key blob (OpenSSH format) More... | |
Detailed Description
SSH key formatting.
License
SPDX-License-Identifier: GPL-2.0-or-later
Copyright (C) 2019-2024 Oryx Embedded SARL. All rights reserved.
This file is part of CycloneSSH 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 ssh_key_format.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL SSH_TRACE_LEVEL |
Definition at line 32 of file ssh_key_format.c.
Function Documentation
◆ sshFormatDsaPublicKey()
error_t sshFormatDsaPublicKey | ( | const DsaPublicKey * | publicKey, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format a DSA public host key.
- Parameters
-
[in] publicKey Pointer to the DSA public key [out] p Buffer where to store the host key structure [out] written Length of the resulting host key structure
- Returns
- Error code
Definition at line 109 of file ssh_key_format.c.
◆ sshFormatEcdsaPublicKey()
error_t sshFormatEcdsaPublicKey | ( | const EcDomainParameters * | params, |
const EcPublicKey * | publicKey, | ||
uint8_t * | p, | ||
size_t * | written | ||
) |
Format an ECDSA public host key.
- Parameters
-
[in] params EC domain parameters [in] publicKey Pointer to the ECDSA public key [out] p Buffer where to store the host key structure [out] written Length of the resulting host key structure
- Returns
- Error code
Definition at line 186 of file ssh_key_format.c.
◆ sshFormatEd25519PublicKey()
error_t sshFormatEd25519PublicKey | ( | const EddsaPublicKey * | publicKey, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format an Ed25519 public host key.
- Parameters
-
[in] publicKey Pointer to the Ed25519 public key [out] p Buffer where to store the host key structure [out] written Length of the resulting host key structure
- Returns
- Error code
Definition at line 272 of file ssh_key_format.c.
◆ sshFormatEd448PublicKey()
error_t sshFormatEd448PublicKey | ( | const EddsaPublicKey * | publicKey, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format an Ed448 public host key.
- Parameters
-
[in] publicKey Pointer to the Ed448 public key [out] p Buffer where to store the host key structure [out] written Length of the resulting host key structure
- Returns
- Error code
Definition at line 324 of file ssh_key_format.c.
◆ sshFormatOpenSshDsaPrivateKey()
error_t sshFormatOpenSshDsaPrivateKey | ( | const DsaPrivateKey * | privateKey, |
const DsaPublicKey * | publicKey, | ||
uint8_t * | p, | ||
size_t * | written | ||
) |
Format DSA private key blob (OpenSSH format)
- Parameters
-
[in] privateKey Pointer to the DSA private key [in] publicKey Pointer to the DSA public key [out] p Buffer where to store the private key blob [out] written Length of the resulting private key blob
- Returns
- Error code
Definition at line 565 of file ssh_key_format.c.
◆ sshFormatOpenSshEcdsaPrivateKey()
error_t sshFormatOpenSshEcdsaPrivateKey | ( | const EcDomainParameters * | params, |
const EcPrivateKey * | privateKey, | ||
const EcPublicKey * | publicKey, | ||
uint8_t * | p, | ||
size_t * | written | ||
) |
Format ECDSA private key blob (OpenSSH format)
- Parameters
-
[in] params EC domain parameters [in] privateKey Pointer to the ECDSA private key [in] publicKey Pointer to the ECDSA public key [out] p Buffer where to store the private key blob [out] written Length of the resulting private key blob
- Returns
- Error code
Definition at line 682 of file ssh_key_format.c.
◆ sshFormatOpenSshEd25519PrivateKey()
error_t sshFormatOpenSshEd25519PrivateKey | ( | const EddsaPrivateKey * | privateKey, |
const EddsaPublicKey * | publicKey, | ||
uint8_t * | p, | ||
size_t * | written | ||
) |
Format Ed25519 private key blob (OpenSSH format)
- Parameters
-
[in] privateKey Pointer to the Ed25519 private key [in] publicKey Pointer to the Ed25519 public key [out] p Buffer where to store the private key blob [out] written Length of the resulting private key blob
- Returns
- Error code
Definition at line 809 of file ssh_key_format.c.
◆ sshFormatOpenSshEd448PrivateKey()
error_t sshFormatOpenSshEd448PrivateKey | ( | const EddsaPrivateKey * | privateKey, |
const EddsaPublicKey * | publicKey, | ||
uint8_t * | p, | ||
size_t * | written | ||
) |
Format Ed448 private key blob (OpenSSH format)
- Parameters
-
[in] privateKey Pointer to the Ed448 private key [in] publicKey Pointer to the Ed448 public key [out] p Buffer where to store the private key blob [out] written Length of the resulting private key blob
- Returns
- Error code
Definition at line 915 of file ssh_key_format.c.
◆ sshFormatOpenSshPrivateKeyHeader()
error_t sshFormatOpenSshPrivateKeyHeader | ( | uint8_t * | p, |
size_t * | written | ||
) |
Format private key header (OpenSSH format)
- Parameters
-
[out] p Buffer where to store the private key header [out] written Length of the resulting private key header
- Returns
- Error code
Definition at line 375 of file ssh_key_format.c.
◆ sshFormatOpenSshRsaPrivateKey()
error_t sshFormatOpenSshRsaPrivateKey | ( | const RsaPrivateKey * | privateKey, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format RSA private key blob (OpenSSH format)
- Parameters
-
[in] privateKey Pointer to the RSA private key [out] p Buffer where to store the private key blob [out] written Length of the resulting private key blob
- Returns
- Error code
Definition at line 439 of file ssh_key_format.c.
◆ sshFormatRsaPublicKey()
error_t sshFormatRsaPublicKey | ( | const RsaPublicKey * | publicKey, |
uint8_t * | p, | ||
size_t * | written | ||
) |
Format an RSA public host key.
- Parameters
-
[in] publicKey Pointer to the RSA public key [out] p Buffer where to store the host key structure [out] written Length of the resulting host key structure
- Returns
- Error code
Definition at line 53 of file ssh_key_format.c.