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-2024 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.4.0
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 //C++ guard
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 //SSH key formatting functions
48  uint8_t *p, size_t *written);
49 
51  uint8_t *p, size_t *written);
52 
54  const EcPublicKey *publicKey, uint8_t *p, size_t *written);
55 
57  uint8_t *p, size_t *written);
58 
60  uint8_t *p, size_t *written);
61 
62 error_t sshFormatOpenSshPrivateKeyHeader(uint8_t *p, size_t *written);
63 
65  uint8_t *p, size_t *written);
66 
68  const DsaPublicKey *publicKey, uint8_t *p, size_t *written);
69 
71  const EcPrivateKey *privateKey, const EcPublicKey *publicKey,
72  uint8_t *p, size_t *written);
73 
75  const EddsaPublicKey *publicKey, uint8_t *p, size_t *written);
76 
78  const EddsaPublicKey *publicKey, uint8_t *p, size_t *written);
79 
80 //C++ guard
81 #ifdef __cplusplus
82 }
83 #endif
84 
85 #endif
DSA (Digital Signature Algorithm)
ECC (Elliptic Curve Cryptography)
EdDSA (Edwards-Curve Digital Signature Algorithm)
error_t
Error codes.
Definition: error.h:43
uint8_t p
Definition: ndp.h:300
RSA public-key cryptography standard.
error_t sshFormatEcdsaPublicKey(const EcDomainParameters *params, const EcPublicKey *publicKey, uint8_t *p, size_t *written)
Format an ECDSA public host key.
error_t sshFormatOpenSshEd25519PrivateKey(const EddsaPrivateKey *privateKey, const EddsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format Ed25519 private key blob (OpenSSH format)
error_t sshFormatOpenSshEd448PrivateKey(const EddsaPrivateKey *privateKey, const EddsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format Ed448 private key blob (OpenSSH format)
error_t sshFormatOpenSshDsaPrivateKey(const DsaPrivateKey *privateKey, const DsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format DSA private key blob (OpenSSH format)
error_t sshFormatOpenSshRsaPrivateKey(const RsaPrivateKey *privateKey, uint8_t *p, size_t *written)
Format RSA private key blob (OpenSSH format)
error_t sshFormatOpenSshPrivateKeyHeader(uint8_t *p, size_t *written)
Format private key header (OpenSSH format)
error_t sshFormatEd25519PublicKey(const EddsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format an Ed25519 public host key.
error_t sshFormatRsaPublicKey(const RsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format an RSA public host key.
error_t sshFormatDsaPublicKey(const DsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format a DSA public host key.
error_t sshFormatOpenSshEcdsaPrivateKey(const EcDomainParameters *params, const EcPrivateKey *privateKey, const EcPublicKey *publicKey, uint8_t *p, size_t *written)
Format ECDSA private key blob (OpenSSH format)
error_t sshFormatEd448PublicKey(const EddsaPublicKey *publicKey, uint8_t *p, size_t *written)
Format an Ed448 public host key.
SSH data type representations.
DSA private key.
Definition: dsa.h:72
DSA public key.
Definition: dsa.h:61
EC domain parameters.
Definition: ec.h:76
EC private key.
Definition: ec.h:104
EC public key.
Definition: ec.h:94
EdDSA private key.
Definition: eddsa.h:59
EdDSA public key.
Definition: eddsa.h:49
RSA private key.
Definition: rsa.h:68
RSA public key.
Definition: rsa.h:57