Skip to content

Conversation

ym
Copy link
Contributor

@ym ym commented May 23, 2025

No description provided.

@ym ym requested a review from Copilot May 23, 2025 13:21
@ym ym marked this pull request as ready for review May 23, 2025 13:21
Copy link
Contributor

@Copilot Copilot AI left a comment

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 support for ED25519 certificates to the websecure package. Key changes include adding ED25519 support in the key conversion function within utils.go and introducing tests in ed25519_test.go to validate saving such certificates.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/websecure/utils.go Added ED25519 key handling in keyToFile via a new switch-case.
internal/websecure/ed25519_test.go Introduced tests for validating ED25519 certificate storage.
Comments suppressed due to low confidence (1)

internal/websecure/ed25519_test.go:52

  • Enhance the test by asserting that the certificate has been properly saved and added to the store, rather than only failing on an error return.
err, _ := certStore.ValidateAndSaveCertificate("ed25519-test.jetkvm.com", fixtureEd25519Certificate, fixtureEd25519PrivateKey, true)

Comment on lines +46 to +48
keyBlock = pem.Block{
Type: "ED25519 PRIVATE KEY",
Bytes: k,
Copy link
Preview

Copilot AI May 23, 2025

Choose a reason for hiding this comment

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

Consider marshaling the ED25519 key using a standard encoding function such as x509.MarshalPKCS8PrivateKey for consistency with other key types and to ensure proper PEM formatting.

Suggested change
keyBlock = pem.Block{
Type: "ED25519 PRIVATE KEY",
Bytes: k,
b, e := x509.MarshalPKCS8PrivateKey(k)
if e != nil {
return fmt.Errorf("failed to marshal ED25519 private key: %v", e)
}
keyBlock = pem.Block{
Type: "PRIVATE KEY",
Bytes: b,

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@IDisposable IDisposable May 23, 2025

Choose a reason for hiding this comment

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

@copilot you bungled the `Type: "PRIVATE KEY", losing the information that it is a ED25519 key.

@ym ym force-pushed the feat/tls-ed25519 branch from 6b95bd6 to 4e6cb08 Compare May 23, 2025 13:26
@ym ym merged commit a28676c into jetkvm:dev May 25, 2025
5 checks passed
ym added a commit to ym/jetkvm-kvm that referenced this pull request Sep 26, 2025
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.

2 participants