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

Add new algorithms supported in firmware 5.7.x #157

Open
wants to merge 2 commits into
base: v2
Choose a base branch
from

Conversation

maraino
Copy link

@maraino maraino commented Sep 24, 2024

This commit supports the new algorithms supported on YubiKeys with a 5.7.x firmware. It adds support for RSA-3072, RSA-4096, Ed25519, and X25519.

Generating X25519 keys is only supported with Go 1.20+, which adds support for the crypto/ecdh package.

Note that this commit removes the support for Ed25519 on SoloKeys if the algorithm identifier is set to 0x22.

Fixes #143

This commit supports the new algorithms supported on YubiKeys with a
5.7.x firmware. It adds support for RSA-3072, RSA-4096, Ed25519, and
X25519.

Generating or importing X25519 keys is only supported with Go 1.20+,
which adds support for the crypto/ecdh package.
v2/piv/key_go120.go Outdated Show resolved Hide resolved
v2/piv/key_go120.go Outdated Show resolved Hide resolved
v2/piv/key_go120.go Outdated Show resolved Hide resolved
v2/piv/key_go120_test.go Outdated Show resolved Hide resolved
v2/piv/key_legacy.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@ericchiang ericchiang left a comment

Choose a reason for hiding this comment

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

This looks great! A couple of comments, but otherwise lgtm

Copy link
Collaborator

Choose a reason for hiding this comment

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

https://go.dev/doc/devel/release#policy

Versions of Go earlier than 1.20 are no longer supported. Let's not bother with this?

"fmt"
)

type X25519PrivateKey struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add a comment to this exported type similar to ECDSAPrivateKey, explaining that users are expected to type case private keys to this type.

https://pkg.go.dev/github.com/go-piv/piv-go/v2/piv#ECDSAPrivateKey

})
}

func (yk *YubiKey) tryX25519PrivateKey(slot Slot, public crypto.PublicKey, auth KeyAuth, pp PINPolicy) (crypto.PrivateKey, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Go generally doesn't use "try" in the method name

newX25519PrivateKey()

}
}

func (yk *YubiKey) tryX22519PrivateKeyInsecure(private crypto.PrivateKey) ([][]byte, byte, int, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

"setX22519PrivateKeyInsecure"

Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto: let's remove this and drop support for earlier versions of Go

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.

Support new key types in Yubikey 5.7 firmware
3 participants