ssh_key_parse.h File Reference

SSH key parsing. More...

#include "ssh_types.h"

Go to the source code of this file.

Data Structures

struct  SshRsaHostKey
 RSA host key. More...
 
struct  SshDsaHostKey
 DSA host key. More...
 
struct  SshEcdsaHostKey
 ECDSA host key. More...
 
struct  SshEddsaHostKey
 EdDSA host key. More...
 
struct  SshPrivateKeyHeader
 Private key header (OpenSSH format) More...
 
struct  SshRsaPrivateKey
 RSA private key (OpenSSH format) More...
 
struct  SshDsaPrivateKey
 DSA private key (OpenSSH format) More...
 
struct  SshEcdsaPrivateKey
 ECDSA private key (OpenSSH format) More...
 
struct  SshEddsaPrivateKey
 EdDSA private key (OpenSSH format) More...
 

Macros

#define SSH_AUTH_MAGIC_SIZE   15
 

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.

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

Definition in file ssh_key_parse.h.

Macro Definition Documentation

◆ SSH_AUTH_MAGIC_SIZE

#define SSH_AUTH_MAGIC_SIZE   15

Definition at line 38 of file ssh_key_parse.h.

Function Documentation

◆ sshCheckPrivateKeyPadding()

error_t sshCheckPrivateKeyPadding ( const uint8_t *  pad,
size_t  length 
)

Check padding string.

Parameters
[in]padPointer to the padding string
[in]lengthLength 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]dataPointer to the host key structure
[in]lengthLength of the host key structure, in bytes
[out]hostKeyInformation 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]dataPointer to the host key structure
[in]lengthLength of the host key structure, in bytes
[out]hostKeyInformation 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]dataPointer to the host key structure
[in]lengthLength of the host key structure, in bytes
[out]hostKeyInformation 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]dataPointer to the host key structure
[in]lengthLength of the host key structure, in bytes
[out]hostKeyInformation resulting from the parsing process
Returns
Error code

Definition at line 403 of file ssh_key_parse.c.

◆ sshParseHostKey()

error_t sshParseHostKey ( const uint8_t *  data,
size_t  length,
SshString keyFormatId 
)

Parse host key structure.

Parameters
[in]dataPointer to the host key structure
[in]lengthLength of the host key structure, in bytes
[out]keyFormatIdInformation 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]dataPointer to the private key blob
[in]lengthLength of the private key blob, in bytes
[out]privateKeyInformation 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]dataPointer to the private key blob
[in]lengthLength of the private key blob, in bytes
[out]privateKeyInformation 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]dataPointer to the private key blob
[in]lengthLength of the private key blob, in bytes
[out]privateKeyInformation 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]dataPointer to the private key blob
[in]lengthLength of the private key blob, in bytes
[out]privateKeyInformation 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]dataPointer to the private key structure
[in]lengthLength of the private key structure, in bytes
[out]privateKeyHeaderInformation 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]dataPointer to the private key blob
[in]lengthLength of the private key blob, in bytes
[out]privateKeyInformation 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]dataPointer to the host key structure
[in]lengthLength of the host key structure, in bytes
[out]hostKeyInformation resulting from the parsing process
Returns
Error code

Definition at line 141 of file ssh_key_parse.c.