SSH key parsing. More...
#include "ssh/ssh.h"
#include "ssh/ssh_key_parse.h"
#include "ssh/ssh_misc.h"
#include "ecc/eddsa.h"
#include "debug.h"
Go to the source code of this file.
Macros | |
#define | TRACE_LEVEL SSH_TRACE_LEVEL |
Functions | |
error_t | sshParseHostKey (const uint8_t *data, size_t length, SshString *keyFormatId) |
Parse host key structure. More... | |
error_t | sshParseRsaHostKey (const uint8_t *data, size_t length, SshRsaHostKey *hostKey) |
Parse an RSA host key structure. More... | |
error_t | sshParseDsaHostKey (const uint8_t *data, size_t length, SshDsaHostKey *hostKey) |
Parse a DSA host key structure. More... | |
error_t | sshParseEcdsaHostKey (const uint8_t *data, size_t length, SshEcdsaHostKey *hostKey) |
Parse an ECDSA host key structure. More... | |
error_t | sshParseEd25519HostKey (const uint8_t *data, size_t length, SshEddsaHostKey *hostKey) |
Parse an Ed25519 host key structure. More... | |
error_t | sshParseEd448HostKey (const uint8_t *data, size_t length, SshEddsaHostKey *hostKey) |
Parse an Ed448 host key structure. More... | |
error_t | sshParseOpenSshPrivateKeyHeader (const uint8_t *data, size_t length, SshPrivateKeyHeader *privateKeyHeader) |
Parse private key header (OpenSSH format) More... | |
error_t | sshParseOpenSshRsaPrivateKey (const uint8_t *data, size_t length, SshRsaPrivateKey *privateKey) |
Parse RSA private key blob (OpenSSH format) More... | |
error_t | sshParseOpenSshDsaPrivateKey (const uint8_t *data, size_t length, SshDsaPrivateKey *privateKey) |
Parse DSA private key blob (OpenSSH format) More... | |
error_t | sshParseOpenSshEcdsaPrivateKey (const uint8_t *data, size_t length, SshEcdsaPrivateKey *privateKey) |
Parse ECDSA private key blob (OpenSSH format) More... | |
error_t | sshParseOpenSshEd25519PrivateKey (const uint8_t *data, size_t length, SshEddsaPrivateKey *privateKey) |
Parse Ed25519 private key blob (OpenSSH format) More... | |
error_t | sshParseOpenSshEd448PrivateKey (const uint8_t *data, size_t length, SshEddsaPrivateKey *privateKey) |
Parse Ed448 private key blob (OpenSSH format) More... | |
error_t | sshCheckPrivateKeyPadding (const uint8_t *pad, size_t length) |
Check padding string. More... | |
Detailed Description
SSH key parsing.
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_parse.c.
Macro Definition Documentation
◆ TRACE_LEVEL
#define TRACE_LEVEL SSH_TRACE_LEVEL |
Definition at line 32 of file ssh_key_parse.c.
Function Documentation
◆ sshCheckPrivateKeyPadding()
error_t sshCheckPrivateKeyPadding | ( | const uint8_t * | pad, |
size_t | length | ||
) |
Check padding string.
- Parameters
-
[in] pad Pointer to the padding string [in] length Length of the padding string, in bytes
- Returns
- Error code
Definition at line 1081 of file ssh_key_parse.c.
◆ sshParseDsaHostKey()
error_t sshParseDsaHostKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshDsaHostKey * | hostKey | ||
) |
Parse a DSA host key structure.
- Parameters
-
[in] data Pointer to the host key structure [in] length Length of the host key structure, in bytes [out] hostKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 202 of file ssh_key_parse.c.
◆ sshParseEcdsaHostKey()
error_t sshParseEcdsaHostKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshEcdsaHostKey * | hostKey | ||
) |
Parse an ECDSA host key structure.
- Parameters
-
[in] data Pointer to the host key structure [in] length Length of the host key structure, in bytes [out] hostKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 283 of file ssh_key_parse.c.
◆ sshParseEd25519HostKey()
error_t sshParseEd25519HostKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshEddsaHostKey * | hostKey | ||
) |
Parse an Ed25519 host key structure.
- Parameters
-
[in] data Pointer to the host key structure [in] length Length of the host key structure, in bytes [out] hostKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 348 of file ssh_key_parse.c.
◆ sshParseEd448HostKey()
error_t sshParseEd448HostKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshEddsaHostKey * | hostKey | ||
) |
Parse an Ed448 host key structure.
- Parameters
-
[in] data Pointer to the host key structure [in] length Length of the host key structure, in bytes [out] hostKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 403 of file ssh_key_parse.c.
◆ sshParseHostKey()
Parse host key structure.
- Parameters
-
[in] data Pointer to the host key structure [in] length Length of the host key structure, in bytes [out] keyFormatId Information resulting from the parsing process
- Returns
- Error code
Definition at line 53 of file ssh_key_parse.c.
◆ sshParseOpenSshDsaPrivateKey()
error_t sshParseOpenSshDsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshDsaPrivateKey * | privateKey | ||
) |
Parse DSA private key blob (OpenSSH format)
- Parameters
-
[in] data Pointer to the private key blob [in] length Length of the private key blob, in bytes [out] privateKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 682 of file ssh_key_parse.c.
◆ sshParseOpenSshEcdsaPrivateKey()
error_t sshParseOpenSshEcdsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshEcdsaPrivateKey * | privateKey | ||
) |
Parse ECDSA private key blob (OpenSSH format)
- Parameters
-
[in] data Pointer to the private key blob [in] length Length of the private key blob, in bytes [out] privateKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 797 of file ssh_key_parse.c.
◆ sshParseOpenSshEd25519PrivateKey()
error_t sshParseOpenSshEd25519PrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshEddsaPrivateKey * | privateKey | ||
) |
Parse Ed25519 private key blob (OpenSSH format)
- Parameters
-
[in] data Pointer to the private key blob [in] length Length of the private key blob, in bytes [out] privateKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 896 of file ssh_key_parse.c.
◆ sshParseOpenSshEd448PrivateKey()
error_t sshParseOpenSshEd448PrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshEddsaPrivateKey * | privateKey | ||
) |
Parse Ed448 private key blob (OpenSSH format)
- Parameters
-
[in] data Pointer to the private key blob [in] length Length of the private key blob, in bytes [out] privateKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 989 of file ssh_key_parse.c.
◆ sshParseOpenSshPrivateKeyHeader()
error_t sshParseOpenSshPrivateKeyHeader | ( | const uint8_t * | data, |
size_t | length, | ||
SshPrivateKeyHeader * | privateKeyHeader | ||
) |
Parse private key header (OpenSSH format)
- Parameters
-
[in] data Pointer to the private key structure [in] length Length of the private key structure, in bytes [out] privateKeyHeader Information resulting from the parsing process
- Returns
- Error code
Definition at line 458 of file ssh_key_parse.c.
◆ sshParseOpenSshRsaPrivateKey()
error_t sshParseOpenSshRsaPrivateKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshRsaPrivateKey * | privateKey | ||
) |
Parse RSA private key blob (OpenSSH format)
- Parameters
-
[in] data Pointer to the private key blob [in] length Length of the private key blob, in bytes [out] privateKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 557 of file ssh_key_parse.c.
◆ sshParseRsaHostKey()
error_t sshParseRsaHostKey | ( | const uint8_t * | data, |
size_t | length, | ||
SshRsaHostKey * | hostKey | ||
) |
Parse an RSA host key structure.
- Parameters
-
[in] data Pointer to the host key structure [in] length Length of the host key structure, in bytes [out] hostKey Information resulting from the parsing process
- Returns
- Error code
Definition at line 141 of file ssh_key_parse.c.