ssh_key_format.h
Go to the documentation of this file.
1 /**
2  * @file ssh_key_format.h
3  * @brief SSH key formatting
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2019-2025 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneSSH Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 2.5.2
29  **/
30 
31 #ifndef _SSH_KEY_FORMAT_H
32 #define _SSH_KEY_FORMAT_H
33 
34 //Dependencies
35 #include "ssh_types.h"
36 #include "pkc/rsa.h"
37 #include "pkc/dsa.h"
38 #include "ecc/ec.h"
39 #include "ecc/eddsa.h"
40 
41 //Helper macro
42 #define SSH_INC_POINTER(p, n) ((p != NULL) ? (p + n) : NULL)
43 
44 //C++ guard
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 //SSH key formatting functions
51  uint8_t *p, size_t *written);
52 
54  uint8_t *p, size_t *written);
55 
57  uint8_t *p, size_t *written);
58 
60  uint8_t *p, size_t *written);
61 
63  uint8_t *p, size_t *written);
64 
65 error_t sshFormatOpenSshPrivateKeyHeader(uint8_t *p, size_t *written);
66 
68  uint8_t *p, size_t *written);
69 
71  uint8_t *p, size_t *written);
72 
74  uint8_t *p, size_t *written);
75 
77  uint8_t *p, size_t *written);
78 
80  uint8_t *p, size_t *written);
81 
82 //C++ guard
83 #ifdef __cplusplus
84 }
85 #endif
86 
87 #endif
error_t sshFormatOpenSshPrivateKeyHeader(uint8_t *p, size_t *written)
Format private key header (OpenSSH format)
error_t sshFormatOpenSshEd25519PrivateKey(const EddsaPrivateKey *privateKey, uint8_t *p, size_t *written)
Format Ed25519 private key blob (OpenSSH format)
error_t sshFormatEcdsaPublicKey(const EcPublicKey *publicKey, uint8_t *p, size_t *written)
Format an ECDSA public host key.
uint8_t p
Definition: ndp.h:300
error_t sshFormatRsaPublicKey(const RsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format an RSA public host key.
error_t sshFormatOpenSshEd448PrivateKey(const EddsaPrivateKey *privateKey, uint8_t *p, size_t *written)
Format Ed448 private key blob (OpenSSH format)
error_t sshFormatEd448PublicKey(const EddsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format an Ed448 public host key.
DSA public key.
Definition: dsa.h:61
error_t
Error codes.
Definition: error.h:43
EdDSA public key.
Definition: eddsa.h:64
error_t sshFormatOpenSshRsaPrivateKey(const RsaPrivateKey *privateKey, uint8_t *p, size_t *written)
Format RSA private key blob (OpenSSH format)
RSA public key.
Definition: rsa.h:57
EdDSA (Edwards-Curve Digital Signature Algorithm)
RSA public-key cryptography standard.
DSA (Digital Signature Algorithm)
EC private key.
Definition: ec.h:432
DSA private key.
Definition: dsa.h:72
error_t sshFormatOpenSshEcdsaPrivateKey(const EcPrivateKey *privateKey, uint8_t *p, size_t *written)
Format ECDSA private key blob (OpenSSH format)
EdDSA private key.
Definition: eddsa.h:75
error_t sshFormatDsaPublicKey(const DsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format a DSA public host key.
EC public key.
Definition: ec.h:421
SSH data type representations.
RSA private key.
Definition: rsa.h:68
ECC (Elliptic Curve Cryptography)
error_t sshFormatOpenSshDsaPrivateKey(const DsaPrivateKey *privateKey, uint8_t *p, size_t *written)
Format DSA private key blob (OpenSSH format)
error_t sshFormatEd25519PublicKey(const EddsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format an Ed25519 public host key.