Skip to content

Conversation

@hanish520
Copy link
Contributor

The eddsa private key is encoded as PEM(PKCS#8) format. While decoding the private key a bug was introduced to generate a new key from the encoded bytes.
Fixed the issue by decoding the private key with same format.

The eddsa private key is encoded as PEM(PKCS#8) format.
While decoding the private key a bug was introduced to generate
a new key from the encoded bytes.
Fixed the issue by decoding the private key with same format.
@codecov
Copy link

codecov bot commented Mar 10, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 62.53%. Comparing base (301532c) to head (18716fd).

Files Patch % Lines
crypto/keygen/keygen.go 33.33% 4 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #123      +/-   ##
==========================================
+ Coverage   62.46%   62.53%   +0.07%     
==========================================
  Files          79       79              
  Lines        7576     7584       +8     
==========================================
+ Hits         4732     4743      +11     
  Misses       2541     2541              
+ Partials      303      300       -3     
Flag Coverage Δ
unittests 62.53% <33.33%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hanish520 hanish520 requested a review from meling March 10, 2024 21:47
Copy link
Member

@meling meling left a comment

Choose a reason for hiding this comment

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

Minor changes

key, err = x509.ParseECPrivateKey(b.Bytes)
case eddsa.PrivateKeyFileType:
key = ed25519.NewKeyFromSeed(b.Bytes[:32])
//key = ed25519.NewKeyFromSeed(b.Bytes[:32])
Copy link
Member

Choose a reason for hiding this comment

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

Delete

//key = ed25519.NewKeyFromSeed(b.Bytes[:32])
var genericKey any
var ok bool
genericKey, err = x509.ParsePKCS8PrivateKey(b.Bytes)
Copy link
Member

Choose a reason for hiding this comment

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

You can do:

genericKey, err :=

To avoid the var genericKey any line above.

key = ed25519.NewKeyFromSeed(b.Bytes[:32])
//key = ed25519.NewKeyFromSeed(b.Bytes[:32])
var genericKey any
var ok bool
Copy link
Member

Choose a reason for hiding this comment

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

Move ok closer to its usage point.

@meling meling merged commit daffe57 into master Mar 12, 2024
@meling meling deleted the fixeddsa branch March 12, 2024 13:18
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.

3 participants