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-2026 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.6.4
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 #include "pqc/mldsa.h"
41 
42 //Helper macro
43 #define SSH_INC_POINTER(p, n) ((p != NULL) ? (p + n) : NULL)
44 
45 //C++ guard
46 #ifdef __cplusplus
47 extern "C" {
48 #endif
49 
50 //SSH key formatting functions
52  uint8_t *p, size_t *written);
53 
55  uint8_t *p, size_t *written);
56 
58  uint8_t *p, size_t *written);
59 
61  uint8_t *p, size_t *written);
62 
64  uint8_t *p, size_t *written);
65 
67  uint8_t *p, size_t *written);
68 
69 error_t sshFormatOpenSshPrivateKeyHeader(uint8_t *p, size_t *written);
70 
72  uint8_t *p, size_t *written);
73 
75  uint8_t *p, size_t *written);
76 
78  uint8_t *p, size_t *written);
79 
81  uint8_t *p, size_t *written);
82 
84  uint8_t *p, size_t *written);
85 
86 //C++ guard
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #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.
ML-DSA public key.
Definition: mldsa.h:82
DSA public key.
Definition: dsa.h:61
error_t sshFormatMldsaPublicKey(const MldsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format an ML-DSA public host key.
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)
ML-DSA (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.