SSH key file import functions. More...
#include "ssh_types.h"
#include "ssh_key_parse.h"
#include "pkix/x509_common.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.
Data Structures | |
struct | SshKeyType |
SSH key type. More... | |
Functions | |
error_t | sshImportRsaPublicKey (const char_t *input, size_t length, RsaPublicKey *publicKey) |
Decode an SSH public key file containing an RSA public key. More... | |
error_t | sshImportDsaPublicKey (const char_t *input, size_t length, DsaPublicKey *publicKey) |
Decode an SSH public key file containing a DSA public key. More... | |
error_t | sshImportEcdsaPublicKey (const char_t *input, size_t length, EcDomainParameters *params, EcPublicKey *publicKey) |
Decode an SSH public key file containing an ECDSA public key. More... | |
error_t | sshImportEd25519PublicKey (const char_t *input, size_t length, EddsaPublicKey *publicKey) |
Decode an SSH public key file containing an Ed25519 public key. More... | |
error_t | sshImportEd448PublicKey (const char_t *input, size_t length, EddsaPublicKey *publicKey) |
Decode an SSH public key file containing an Ed448 public key. More... | |
error_t | sshImportRsaPrivateKey (const char_t *input, size_t length, const char_t *password, RsaPrivateKey *privateKey) |
Decode an SSH private key file containing an RSA private key. More... | |
error_t | sshImportDsaPrivateKey (const char_t *input, size_t length, const char_t *password, DsaPrivateKey *privateKey) |
Decode an SSH private key file containing a DSA private key. More... | |
error_t | sshImportEcdsaPrivateKey (const char_t *input, size_t length, const char_t *password, EcPrivateKey *privateKey) |
Decode an SSH private key file containing an ECDSA private key. More... | |
error_t | sshImportEd25519PrivateKey (const char_t *input, size_t length, const char_t *password, EddsaPrivateKey *privateKey) |
Decode an SSH private key file containing an Ed25519 private key. More... | |
error_t | sshImportEd448PrivateKey (const char_t *input, size_t length, const char_t *password, EddsaPrivateKey *privateKey) |
Decode an SSH private key file containing an Ed448 private key. More... | |
error_t | sshImportRsaHostKey (const SshRsaHostKey *hostKey, RsaPublicKey *publicKey) |
Import an RSA host key. More... | |
error_t | sshImportDsaHostKey (const SshDsaHostKey *hostKey, DsaPublicKey *publicKey) |
Import a DSA host key. More... | |
error_t | sshImportEcdsaHostKey (const SshEcdsaHostKey *hostKey, EcDomainParameters *params, EcPublicKey *publicKey) |
Import a ECDSA host key. More... | |
error_t | sshImportEd25519HostKey (const SshEddsaHostKey *hostKey, EddsaPublicKey *publicKey) |
Import an Ed25519 host key. More... | |
error_t | sshImportEd448HostKey (const SshEddsaHostKey *hostKey, EddsaPublicKey *publicKey) |
Import an Ed448 host key. More... | |
const char_t * | sshGetPublicKeyType (const char_t *input, size_t length) |
Get SSH public key type. More... | |
error_t | sshDecodePublicKeyFile (const char_t *input, size_t inputLen, uint8_t *output, size_t *outputLen) |
Decode SSH public key file (SSH2 or OpenSSH format) More... | |
error_t | sshDecodeSsh2PublicKeyFile (const char_t *input, size_t inputLen, uint8_t *output, size_t *outputLen) |
Decode SSH public key file (SSH2 format) More... | |
error_t | sshDecodeOpenSshPublicKeyFile (const char_t *input, size_t inputLen, uint8_t *output, size_t *outputLen) |
Decode SSH public key file (OpenSSH format) More... | |
error_t | sshDecodeOpenSshPrivateKeyFile (const char_t *input, size_t inputLen, uint8_t *output, size_t *outputLen) |
Decode SSH private key file (OpenSSH format) More... | |
int_t | sshSearchMarker (const char_t *s, size_t sLen, const char_t *marker, size_t markerLen) |
Search a string for a given marker. More... | |
Detailed Description
SSH key file import functions.
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_import.h.
Function Documentation
◆ sshDecodeOpenSshPrivateKeyFile()
error_t sshDecodeOpenSshPrivateKeyFile | ( | const char_t * | input, |
size_t | inputLen, | ||
uint8_t * | output, | ||
size_t * | outputLen | ||
) |
Decode SSH private key file (OpenSSH format)
- Parameters
-
[in] input SSH public key file to decode [in] inputLen Length of the SSH private key file to decode [out] output Pointer to the decoded data (optional parameter) [out] outputLen Length of the decoded data
Definition at line 1709 of file ssh_key_import.c.
◆ sshDecodeOpenSshPublicKeyFile()
error_t sshDecodeOpenSshPublicKeyFile | ( | const char_t * | input, |
size_t | inputLen, | ||
uint8_t * | output, | ||
size_t * | outputLen | ||
) |
Decode SSH public key file (OpenSSH format)
- Parameters
-
[in] input SSH public key file to decode [in] inputLen Length of the SSH public key file to decode [out] output Pointer to the decoded data (optional parameter) [out] outputLen Length of the decoded data
Definition at line 1634 of file ssh_key_import.c.
◆ sshDecodePublicKeyFile()
error_t sshDecodePublicKeyFile | ( | const char_t * | input, |
size_t | inputLen, | ||
uint8_t * | output, | ||
size_t * | outputLen | ||
) |
Decode SSH public key file (SSH2 or OpenSSH format)
- Parameters
-
[in] input SSH public key file to decode [in] inputLen Length of the SSH public key file to decode [out] output Pointer to the decoded data (optional parameter) [out] outputLen Length of the decoded data
Definition at line 1491 of file ssh_key_import.c.
◆ sshDecodeSsh2PublicKeyFile()
error_t sshDecodeSsh2PublicKeyFile | ( | const char_t * | input, |
size_t | inputLen, | ||
uint8_t * | output, | ||
size_t * | outputLen | ||
) |
Decode SSH public key file (SSH2 format)
- Parameters
-
[in] input SSH public key file to decode [in] inputLen Length of the SSH public key file to decode [out] output Pointer to the decoded data (optional parameter) [out] outputLen Length of the decoded data
Definition at line 1519 of file ssh_key_import.c.
◆ sshGetPublicKeyType()
Get SSH public key type.
- Parameters
-
[in] input SSH public key file [in] length Length of the SSH public key file
- Returns
- SSH public key type
Definition at line 1348 of file ssh_key_import.c.
◆ sshImportDsaHostKey()
error_t sshImportDsaHostKey | ( | const SshDsaHostKey * | hostKey, |
DsaPublicKey * | publicKey | ||
) |
Import a DSA host key.
- Parameters
-
[in] hostKey Pointer to the host key structure [out] publicKey Pointer to the DSA public key
- Returns
- Error code
Definition at line 1190 of file ssh_key_import.c.
◆ sshImportDsaPrivateKey()
error_t sshImportDsaPrivateKey | ( | const char_t * | input, |
size_t | length, | ||
const char_t * | password, | ||
DsaPrivateKey * | privateKey | ||
) |
Decode an SSH private key file containing a DSA private key.
- Parameters
-
[in] input Pointer to the SSH private key file [in] length Length of the SSH private key file [in] password NULL-terminated string containing the password. This parameter is required if the private key is encrypted [out] privateKey DSA private key resulting from the parsing process
- Returns
- Error code
Definition at line 693 of file ssh_key_import.c.
◆ sshImportDsaPublicKey()
error_t sshImportDsaPublicKey | ( | const char_t * | input, |
size_t | length, | ||
DsaPublicKey * | publicKey | ||
) |
Decode an SSH public key file containing a DSA public key.
- Parameters
-
[in] input Pointer to the SSH public key file [in] length Length of the SSH public key file [out] publicKey DSA public key resulting from the parsing process
- Returns
- Error code
Definition at line 169 of file ssh_key_import.c.
◆ sshImportEcdsaHostKey()
error_t sshImportEcdsaHostKey | ( | const SshEcdsaHostKey * | hostKey, |
EcDomainParameters * | params, | ||
EcPublicKey * | publicKey | ||
) |
Import a ECDSA host key.
- Parameters
-
[in] hostKey Pointer to the host key structure [out] params EC domain parameters [out] publicKey Pointer to the ECDSA public key
- Returns
- Error code
Definition at line 1249 of file ssh_key_import.c.
◆ sshImportEcdsaPrivateKey()
error_t sshImportEcdsaPrivateKey | ( | const char_t * | input, |
size_t | length, | ||
const char_t * | password, | ||
EcPrivateKey * | privateKey | ||
) |
Decode an SSH private key file containing an ECDSA private key.
- Parameters
-
[in] input Pointer to the SSH private key file [in] length Length of the SSH private key file [in] password NULL-terminated string containing the password. This parameter is required if the private key is encrypted [out] privateKey ECDSA private key resulting from the parsing process
- Returns
- Error code
Definition at line 825 of file ssh_key_import.c.
◆ sshImportEcdsaPublicKey()
error_t sshImportEcdsaPublicKey | ( | const char_t * | input, |
size_t | length, | ||
EcDomainParameters * | params, | ||
EcPublicKey * | publicKey | ||
) |
Decode an SSH public key file containing an ECDSA public key.
- Parameters
-
[in] input Pointer to the SSH public key file [in] length Length of the SSH public key file [out] params EC domain parameters resulting from the parsing process [out] publicKey ECDSA public key resulting from the parsing process
- Returns
- Error code
Definition at line 253 of file ssh_key_import.c.
◆ sshImportEd25519HostKey()
error_t sshImportEd25519HostKey | ( | const SshEddsaHostKey * | hostKey, |
EddsaPublicKey * | publicKey | ||
) |
Import an Ed25519 host key.
- Parameters
-
[in] hostKey Pointer to the host key structure [out] publicKey Pointer to the Ed25519 public key
- Returns
- Error code
Definition at line 1296 of file ssh_key_import.c.
◆ sshImportEd25519PrivateKey()
error_t sshImportEd25519PrivateKey | ( | const char_t * | input, |
size_t | length, | ||
const char_t * | password, | ||
EddsaPrivateKey * | privateKey | ||
) |
Decode an SSH private key file containing an Ed25519 private key.
- Parameters
-
[in] input Pointer to the SSH private key file [in] length Length of the SSH private key file [in] password NULL-terminated string containing the password. This parameter is required if the private key is encrypted [out] privateKey Ed25519 private key resulting from the parsing process
- Returns
- Error code
Definition at line 933 of file ssh_key_import.c.
◆ sshImportEd25519PublicKey()
error_t sshImportEd25519PublicKey | ( | const char_t * | input, |
size_t | length, | ||
EddsaPublicKey * | publicKey | ||
) |
Decode an SSH public key file containing an Ed25519 public key.
- Parameters
-
[in] input Pointer to the SSH public key file [in] length Length of the SSH public key file [out] publicKey Ed25519 public key resulting from the parsing process
- Returns
- Error code
Definition at line 344 of file ssh_key_import.c.
◆ sshImportEd448HostKey()
error_t sshImportEd448HostKey | ( | const SshEddsaHostKey * | hostKey, |
EddsaPublicKey * | publicKey | ||
) |
Import an Ed448 host key.
- Parameters
-
[in] hostKey Pointer to the host key structure [out] publicKey Pointer to the Ed448 public key
- Returns
- Error code
Definition at line 1322 of file ssh_key_import.c.
◆ sshImportEd448PrivateKey()
error_t sshImportEd448PrivateKey | ( | const char_t * | input, |
size_t | length, | ||
const char_t * | password, | ||
EddsaPrivateKey * | privateKey | ||
) |
Decode an SSH private key file containing an Ed448 private key.
- Parameters
-
[in] input Pointer to the SSH private key file [in] length Length of the SSH private key file [in] password NULL-terminated string containing the password. This parameter is required if the private key is encrypted [out] privateKey Ed448 private key resulting from the parsing process
- Returns
- Error code
Definition at line 1041 of file ssh_key_import.c.
◆ sshImportEd448PublicKey()
error_t sshImportEd448PublicKey | ( | const char_t * | input, |
size_t | length, | ||
EddsaPublicKey * | publicKey | ||
) |
Decode an SSH public key file containing an Ed448 public key.
- Parameters
-
[in] input Pointer to the SSH public key file [in] length Length of the SSH public key file [out] publicKey Ed448 public key resulting from the parsing process
- Returns
- Error code
Definition at line 426 of file ssh_key_import.c.
◆ sshImportRsaHostKey()
error_t sshImportRsaHostKey | ( | const SshRsaHostKey * | hostKey, |
RsaPublicKey * | publicKey | ||
) |
Import an RSA host key.
- Parameters
-
[in] hostKey Pointer to the host key structure [out] publicKey Pointer to the RSA public key
- Returns
- Error code
Definition at line 1146 of file ssh_key_import.c.
◆ sshImportRsaPrivateKey()
error_t sshImportRsaPrivateKey | ( | const char_t * | input, |
size_t | length, | ||
const char_t * | password, | ||
RsaPrivateKey * | privateKey | ||
) |
Decode an SSH private key file containing an RSA private key.
- Parameters
-
[in] input Pointer to the SSH private key file [in] length Length of the SSH private key file [in] password NULL-terminated string containing the password. This parameter is required if the private key is encrypted [out] privateKey RSA private key resulting from the parsing process
- Returns
- Error code
Definition at line 511 of file ssh_key_import.c.
◆ sshImportRsaPublicKey()
error_t sshImportRsaPublicKey | ( | const char_t * | input, |
size_t | length, | ||
RsaPublicKey * | publicKey | ||
) |
Decode an SSH public key file containing an RSA public key.
- Parameters
-
[in] input Pointer to the SSH public key file [in] length Length of the SSH public key file [out] publicKey RSA public key resulting from the parsing process
- Returns
- Error code
Definition at line 86 of file ssh_key_import.c.
◆ sshSearchMarker()
Search a string for a given marker.
- Parameters
-
[in] s String to search [in] sLen Length of the string to search [in] marker String containing the marker to search for [in] markerLen Length of the marker
- Returns
- The index of the first occurrence of the marker in the string, or -1 if the marker does not appear in the string
Definition at line 1758 of file ssh_key_import.c.