Skip to content

Export keys without a comment - #63

Merged
darinkes merged 1 commit into
mainfrom
fix/null-key-comment
Aug 14, 2026
Merged

Export keys without a comment#63
darinkes merged 1 commit into
mainfrom
fix/null-key-comment

Conversation

@darinkes

Copy link
Copy Markdown
Owner

Formats with no comment field (PKCS#1, SEC1) leave Key.Comment null. The OpenSSH and PuTTY private-key writers passed it straight to Encoding.UTF8.GetBytes, so ToOpenSshFormat() and ToPuttyFormat() threw ArgumentNullException on such a key.

The public-key and fingerprint paths only interpolate the comment into a string, so they were already unaffected.

Fixes #62.

Formats with no comment field (PKCS#1, SEC1) leave Key.Comment null, which
the OpenSSH and PuTTY private-key writers passed straight to
Encoding.UTF8.GetBytes. Fixes #62.
@darinkes
darinkes merged commit 17ee2ec into main Aug 14, 2026
2 checks passed
Sign up for free to 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.

Allow having public key as null when calling ToOpenSshFormat

1 participant