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 support for ECDH key agreement in Transit Secret Engine #811

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

DanGhita
Copy link
Contributor

Resolves #655

Target Release

1.14.7

@DanGhita DanGhita linked an issue Dec 20, 2024 that may be closed by this pull request
@cipherboy cipherboy requested a review from fatima2003 January 23, 2025 14:06
Copy link
Member

@cipherboy cipherboy left a comment

Choose a reason for hiding this comment

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

Some comments!

builtin/logical/transit/path_derive_key.go Show resolved Hide resolved
@@ -161,6 +162,14 @@ func (kt KeyType) DerivationSupported() bool {
return false
}

func (kt KeyType) KeyAgreementSupported() bool {
Copy link
Member

Choose a reason for hiding this comment

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

Little surprised you don't support Curve25519 EdDH derivation :-)

Copy link
Contributor Author

@DanGhita DanGhita Jan 30, 2025

Choose a reason for hiding this comment

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

Strange, my previous comment seems to be lost :(
I was saying: OK, I will try to add KeyType_ED25519, since they are pretty used in the field.
However, if I'm not wrong, they are considered as less secure than the other curves; for example, ANSSI (French Security Agency) considers ED25519 just as an "acceptable" alternative.
Furthermore, digging into the subject, it seems that most of crypto/elliptic functions are deprecated (so, probably I should change the current ECDH implementation):
https://pkg.go.dev/crypto/elliptic#P521

Copy link
Member

Choose a reason for hiding this comment

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

NIST P-Curves are vulnerable to certain problems that Ed25519 isn't: https://safecurves.cr.yp.to/

NIST recently certified EdDSA at the same level as ECDSA in FIPS 186-5.

Copy link
Member

Choose a reason for hiding this comment

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

I think switching to crypto/ecdh would be a good move since it supports both NIST P-Curves and Ed25519.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, that was my idea too, I will play a little bit with the crypto/ecdh API and if everything works fine, I will update my implementation accordingly. Thank you @fatima2003 !

sdk/helper/keysutil/policy.go Show resolved Hide resolved
* ecdh
Defaults to "ecdh".`,
},

Copy link
Member

Choose a reason for hiding this comment

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

Maybe there needs to be a kdf parameter, which accepts "" or "hkdf", and if using HKDF, can add HKDF-specific parameters (like salt or context)? (to answer your TODO below).

Then HKDF can also be a key type potentially, and we can do multiple HKDF invocations (without doing multiple ECDH invocations), if they don't want to use the shared secret directly.

sdk/helper/keysutil/policy.go Show resolved Hide resolved
sdk/helper/keysutil/policy.go Show resolved Hide resolved
sdk/helper/keysutil/policy.go Show resolved Hide resolved
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.

Add support for ECDH key agreement in Transit Secret Engine
3 participants