Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSH Agent PKCS11 Support #362

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions contrib/win32/win32compat/ssh-agent/agent-request.h
Expand Up @@ -18,5 +18,7 @@ int process_request_identities(struct sshbuf*, struct sshbuf*, struct agent_conn
int process_sign_request(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_remove_key(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_remove_all(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_add_smartcard_key(struct sshbuf*, struct sshbuf*, struct agent_connection*);
int process_remove_smartcard_key(struct sshbuf*, struct sshbuf*, struct agent_connection*);

/* auth */
2 changes: 2 additions & 0 deletions contrib/win32/win32compat/ssh-agent/agent.h
Expand Up @@ -8,6 +8,8 @@
#define SSH_AGENT_ROOT SSH_REGISTRY_ROOT L"\\Agent"
#define SSH_KEYS_KEY L"Keys"
#define SSH_KEYS_ROOT SSH_AGENT_ROOT L"\\" SSH_KEYS_KEY
#define SSH_PKCS11_PROVIDERS_KEY L"PKCS11_Providers"
#define SSH_PKCS11_PROVIDERS_ROOT SSH_AGENT_ROOT L"\\" SSH_PKCS11_PROVIDERS_KEY

#define HEADER_SIZE 4

Expand Down
14 changes: 14 additions & 0 deletions contrib/win32/win32compat/ssh-agent/connection.c
Expand Up @@ -31,6 +31,11 @@
#include "agent.h"
#include "agent-request.h"

#ifdef ENABLE_PKCS11
#include "ssh-pkcs11.h"
#define ENABLE_PKCS11
#endif

#pragma warning(push, 3)

int process_request(struct agent_connection*);
Expand Down Expand Up @@ -156,6 +161,15 @@ process_request(struct agent_connection* con)
case SSH2_AGENTC_REMOVE_ALL_IDENTITIES:
r = process_remove_all(request, response, con);
break;
#ifdef ENABLE_PKCS11
case SSH_AGENTC_ADD_SMARTCARD_KEY:
case SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED:
r = process_add_smartcard_key(request, response, con);
break;
case SSH_AGENTC_REMOVE_SMARTCARD_KEY:
r = process_remove_smartcard_key(request, response, con);
break;
#endif /* ENABLE_PKCS11 */
default:
debug("unknown agent request %d", type);
r = -1;
Expand Down