Skip to content

Use of Windows certificate store for authentication - #900

Draft
JacobBarthelmeh wants to merge 10 commits into
wolfSSL:masterfrom
JacobBarthelmeh:winSysCerts
Draft

Use of Windows certificate store for authentication#900
JacobBarthelmeh wants to merge 10 commits into
wolfSSL:masterfrom
JacobBarthelmeh:winSysCerts

Conversation

@JacobBarthelmeh

Copy link
Copy Markdown
Contributor

No description provided.

@JacobBarthelmehJacobBarthelmeh self-assigned this Mar 25, 2026
CopilotAI review requested due to automatic review settings March 25, 2026 12:38

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds Windows Certificate Store integration to wolfSSH so host keys and client authentication keys can be sourced from the Windows cert store (including CI coverage on Windows).

Changes:

  • Add a Windows-only API to load a private key by locating a certificate in the Windows Certificate Store, and use CNG to sign during SSH handshakes/auth.
  • Extend cert manager plumbing and wolfsshd configuration to support system/user CA loading and cert-store-based host keys.
  • Update Windows build projects and add a GitHub Actions workflow to exercise file-vs-store interop permutations.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 8 comments.

Show a summary per file
FileDescription
wolfssh/test.hPrefer wolfCrypt Base16 when available; otherwise keep local Base16 decode helper.
wolfssh/ssh.hAdd wolfSSH_CTX_UsePrivateKey_fromStore() Windows-only public API.
wolfssh/internal.hAdd CTX private-key metadata for cert-store backed keys and internal helper prototypes.
wolfssh/certman.hExpose cert-manager setter and Windows cert-store spec parser API.
src/ssh.cImplement loading a CTX private key from the Windows Certificate Store.
src/internal.cAdd cert-store signing path (CNG) and cert-derived RSA public-key extraction for KEX/auth flows.
src/certman.cImplement wolfSSH_SetCertManager() and wolfSSH_ParseCertStoreSpec().
ide/winvs/wolfsshd/wolfsshd.vcxprojLink against crypt32/ncrypt for cert-store features.
ide/winvs/wolfssh/wolfssh.vcxprojLink against crypt32/ncrypt for cert-store features.
ide/winvs/wolfsftp-client/wolfsftp-client.vcxprojLink against crypt32/ncrypt for cert-store features.
ide/winvs/unit-test/unit-test.vcxprojLink against crypt32/ncrypt for cert-store features; normalize XML header.
ide/winvs/echoserver/echoserver.vcxprojLink against crypt32/ncrypt for cert-store features.
ide/winvs/client/client.vcxprojLink against crypt32/ncrypt for cert-store features.
ide/winvs/api-test/api-test.vcxprojLink against crypt32/ncrypt for cert-store features; normalize XML header.
examples/sftpclient/sftpclient.cAdd -W store:subject:flags support for client key from Windows cert store.
examples/echoserver/echoserver.cAdd -W support for server host key from Windows cert store; skip key-file root search when using store.
examples/client/common.hDeclare helper functions for cert-store key loading/auth setup.
examples/client/common.cImplement cert-store key loading wrapper + auth globals setup for x509v3 publickey auth.
apps/wolfsshd/wolfsshd.cAdd host-key-from-store support and optional system/user CA store loading into wolfSSH cert manager.
apps/wolfsshd/configuration.hAdd config getters for host-key store and Windows user-CA store options.
apps/wolfsshd/configuration.cAdd parsing/storage for new config directives and defaults.
.github/workflows/windows-cert-store-test.ymlAdd Windows CI workflow to validate store/file combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/internal.c Outdated
Comment threadsrc/certman.c
Comment threadsrc/certman.c
Comment threadwolfssh/internal.h Outdated
Comment threadsrc/ssh.c Outdated
Comment threadsrc/ssh.c Outdated
Comment threadsrc/ssh.c Outdated
Comment threadsrc/internal.c
CopilotAI review requested due to automatic review settings April 14, 2026 03:24

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 21 out of 22 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadwolfssh/certman.h
Comment threadsrc/ssh.c Outdated
Comment threadsrc/ssh.c
Comment threadapps/wolfsshd/wolfsshd.c
Comment threadapps/wolfsshd/configuration.c

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadwolfssh/ssh.h
Comment threadwolfssh/internal.h Outdated
Comment threadsrc/ssh.c Outdated
Comment threadsrc/internal.c Outdated
Comment threadsrc/internal.c Outdated
Comment threadapps/wolfsshd/wolfsshd.c Outdated
Comment threadconfigure.ac Outdated
Comment thread.github/workflows/windows-cert-store-test.yml Outdated
Comment threadsrc/internal.c Outdated

@wolfSSL-Fenrir-botwolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #900

Scan targets checked:wolfssh-bugs, wolfssh-src

Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 8 comments.

Comment threadsrc/internal.c Outdated
Comment threadsrc/ssh.c Outdated
Comment threadsrc/ssh.c
Comment threadwolfssh/internal.h Outdated
Comment threadsrc/internal.c
Comment threadsrc/internal.c
Comment threadsrc/internal.c Outdated
Comment threadsrc/internal.c Outdated

@wolfSSL-Fenrir-botwolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #900

Scan targets checked:wolfssh-bugs, wolfssh-src

Findings: 1
1 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

@JacobBarthelmeh
JacobBarthelmeh marked this pull request as ready for review July 2, 2026 22:27
Comment threadsrc/internal.c Outdated
Comment threadsrc/internal.c Outdated
@JacobBarthelmeh
JacobBarthelmeh marked this pull request as draft July 7, 2026 05:11

@wolfSSL-Fenrir-botwolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #900

Scan targets checked:wolfssh-bugs, wolfssh-src

Findings: 3
3 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

@wolfSSL-Fenrir-botwolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #900

Scan targets checked:wolfssh-bugs, wolfssh-src

Findings: 5
5 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@wolfSSL-Fenrir-botwolfSSL-Fenrir-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fenrir Automated Review — PR #900

Scan targets checked:wolfssh-bugs, wolfssh-src

Findings: 2
2 finding(s) posted as inline comments (see file-level comments below)

This review was generated automatically by Fenrir. Findings are non-blocking.

Comment threadapps/wolfsshd/auth.c Outdated
Comment threadapps/wolfsshd/wolfsshd.c Outdated

@aidangarskeaidangarske left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skoll Multi-Scan Review

Modes:review + review-security + bugsOverall recommendation:REQUEST_CHANGES
Findings: 13 total — 13 posted, 0 skipped

Posted findings

  • [High] [review+review-security+bugs] Unknown or undecodable ECC curves are silently registered as P-256src/ssh.c:3106-3121
  • [High] [bugs+review] Certificate-store keys can advertise algorithms excluded from the buildsrc/ssh.c:3075-3105
  • [High] [review+bugs] Switching between TPM and certificate-store keys leaves both backends activesrc/ssh.c:2981-3017
  • [High] [review+review-security+bugs] Windows certificate-store libraries are missing from most Visual Studio configurationside/winvs/wolfsshd/wolfsshd.vcxproj:245-459
  • [High] [review-security] Match blocks cannot restrict the new CA trust sourcesapps/wolfsshd/configuration.c:1348-1372
  • [High] [review] Certificate CN matching conflicts with case-insensitive Windows account namesapps/wolfsshd/auth.c:1792-1797
  • [Medium] [review+review-security] Unsupported certificate-store provider is accepted and then silently ignoredapps/wolfsshd/wolfsshd.c:383-429
  • [Medium] [review-security] Raw numeric location flags can trigger destructive certificate-store operationssrc/certman.c:724-739
  • [Medium] [review] Cert-store authentication leaves the shared client private-key pointer in an invalid reusable stateexamples/client/common.c:1261-1263
  • [Medium] [review] The workflow never exercises the X.509 host-key slot.github/workflows/windows-cert-store-test.yml:522-545
  • [Medium] [bugs] HostKeyStoreSubject cannot contain whitespaceapps/wolfsshd/configuration.c:1384-1389
  • [Low] [review-security] CN lookup selects an arbitrary certificate when renewals share a subjectsrc/ssh.c:2867-2897
  • [Low] [review-security] Configure accepts Cygwin even though the headers reject itconfigure.ac:290-296

Review generated by Skoll

JacobBarthelmehand others added 6 commits August 3, 2026 23:11
add Windows cert store test case
make windows cert feature default disabled and simplify macro guard
additional unit tests, advertise x509 and pubkey, use CN to match username, build check for WOLFSSL_SYS_CA_CERTS, fix for CM ref count
additional build test, uniform enum name, fail on unkown cert store ecc curve, tie in of loading whole cert store for sys CA's
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@JacobBarthelmeh@ejohnstown@aidangarske@wolfSSL-Fenrir-bot@wolfSSL-Bot@kareem-wolfssl