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

Using 64 byte extended (expanded) secret keys #12

Open
gitmachtl opened this issue Dec 4, 2022 · 2 comments
Open

Using 64 byte extended (expanded) secret keys #12

gitmachtl opened this issue Dec 4, 2022 · 2 comments

Comments

@gitmachtl
Copy link

Hi,

first, awesome lib! 👍

I am running in troubles, because i need a function to convert ed25519 extended keys into a curve25519 one, so i can later do a DH on it. Theses extended keys are used on the cardano blockchain and i think follow the NaCl:
https://cips.cardano.org/cips/cip16/
BIP32-Ed25519 extended keys (Ed25519 extended keys with BIP32-style derivation)

Do you see a chance to update the convertSecretKey function do also convert such extended keys?

Example keys:

PrvKey: 78d4bd66ecfe2f828ccb819ab85ed3afee813b06f70e6690a2ed527c1fc709516b7cc91a85aadee46927ee32e87e6fba60d4d9e4fe2527763bc57fe3eec8cbf9
PubKey: cd6d71f11cbd2f63326e5a50d7141a9443bd0f16f4b02f3f2f4d40acc5f83294

Best regards,
Martin

@jose-gataca
Copy link

Hi,

I'm no expert, so I'm not sure if I am providing the right answer, but Ed25519 private keys are usually 64 bytes long, and they are usually encoded so that the first half (32bytes) is the secret key and the second half is the public key.

In the convertSecretKey function, it already processes only the first 32 bytes of the secret key, so it should work correctly. Are you asking about the 96 bytes extended keys that also contain the chain code in 32 bytes?

@gitmachtl
Copy link
Author

Hi, yes normally. But extended ed25519 keys have real 64 bytes for the keypart. Can be extended further with a chaincode, but not a must. But most of the time yes, 64 byte secret key + 32 byte chaincode. or, 64 byte secret key + 32 byte public key + 32 byte chaincode.

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

No branches or pull requests

2 participants