KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kigit_ssh_keys.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.TXT for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#ifndef KIGIT_SSH_KEYS_H_
21#define KIGIT_SSH_KEYS_H_
22
23#include <import_export.h>
24
25#include <string>
26#include <vector>
27
28#include <wx/string.h>
29
30namespace KIGIT
31{
32
40APIEXPORT std::vector<wxString> ParseSSHConfigIdentityFiles( const wxString& aConfigText, const wxString& aHost,
41 const wxString& aHomeDir );
42
47APIEXPORT std::vector<wxString> ParseSSHCommandIdentityFiles( const wxString& aCommand, const wxString& aHomeDir );
48
57APIEXPORT std::vector<wxString> DefaultSSHKeyCandidates( const wxString& aHomeDir, const wxString& aHost,
58 const wxString& aSSHCommand = wxEmptyString );
59
64APIEXPORT bool IsSameSSHKey( const wxString& aKey, const wxString& aOther );
65
70APIEXPORT std::vector<wxString> HomeDirCandidates();
71
76APIEXPORT wxString HomeDir();
77
79APIEXPORT wxString SSHKeyFolder();
80
86APIEXPORT bool IsOfferableSSHKey( const wxString& aKey );
87
92APIEXPORT wxString PublicKeyPath( const wxString& aKey );
93
98APIEXPORT wxString EnsurePublicKeyFile( const wxString& aKey );
99
104APIEXPORT void SetDerivedPublicKeyFolder( const wxString& aDir );
105
109APIEXPORT wxString PrivateKeyPath( const wxString& aPicked );
110
112APIEXPORT std::string PublicKeyBlob( const wxString& aKey );
113
118APIEXPORT wxString RememberedSSHKey( const wxString& aRemote );
119
121APIEXPORT void RememberSSHKey( const wxString& aRemote, const wxString& aKey );
122
127APIEXPORT void SetRememberedSSHKeyStore( const wxString& aPath );
128
129} // namespace KIGIT
130
131#endif // KIGIT_SSH_KEYS_H_
#define APIEXPORT
Macros which export functions from a DLL/DSO.
APIEXPORT wxString PrivateKeyPath(const wxString &aPicked)
The private key for a path picked in a file dialog, which may be the key's .pub file.
APIEXPORT bool IsOfferableSSHKey(const wxString &aKey)
Whether aKey can be offered to a server.
APIEXPORT wxString EnsurePublicKeyFile(const wxString &aKey)
PublicKeyPath for aKey, first writing a public key file to KiCad's cache when the key has no ....
APIEXPORT wxString RememberedSSHKey(const wxString &aRemote)
The key that last connected to aRemote, or empty.
APIEXPORT std::vector< wxString > ParseSSHCommandIdentityFiles(const wxString &aCommand, const wxString &aHomeDir)
The -i key files in an ssh command line such as git's core.sshCommand, in order.
APIEXPORT std::vector< wxString > ParseSSHConfigIdentityFiles(const wxString &aConfigText, const wxString &aHost, const wxString &aHomeDir)
The IdentityFile entries an ssh config gives aHost, in file order.
APIEXPORT wxString PublicKeyPath(const wxString &aKey)
The public key file to offer with aKey.
APIEXPORT void SetDerivedPublicKeyFolder(const wxString &aDir)
Keep public key files written by EnsurePublicKeyFile in aDir.
APIEXPORT std::vector< wxString > DefaultSSHKeyCandidates(const wxString &aHomeDir, const wxString &aHost, const wxString &aSSHCommand=wxEmptyString)
Private keys to offer aHost, best first.
APIEXPORT wxString HomeDir()
The user's home folder, where ssh looks for its config and default keys: the first candidate with a ....
APIEXPORT wxString SSHKeyFolder()
The folder ssh keeps keys in, for a file picker to open at. Empty when the home folder is unknown.
APIEXPORT void RememberSSHKey(const wxString &aRemote, const wxString &aKey)
Remember aKey as the key that connected to aRemote. Safe to call from any thread.
APIEXPORT std::vector< wxString > HomeDirCandidates()
The folders that may be the user's home, most likely first.
APIEXPORT void SetRememberedSSHKeyStore(const wxString &aPath)
Keep remembered keys in aPath.
APIEXPORT std::string PublicKeyBlob(const wxString &aKey)
The public key blob from aKey's public key file, as the server sees it, or empty when it cannot be re...
APIEXPORT bool IsSameSSHKey(const wxString &aKey, const wxString &aOther)
Whether two key paths name the same file.