-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
Ed25519 Support #123
Comments
There is not a standard ed25519 way to do ed25519 via PKCS11 yet. Are you sure your smartcard or HSM supports it? What is your devices make and model? Does their documentation say they support it? Do they provide a sample? If so can you share it? With more info we may be able to help. |
It is the Thales Luna 7 Network HSM, and it's clearly specified in the product presentation that it supports the PKCS11 API and the Ed25519 cryptography. Unfortunately they don't provide a sample to start with. |
@Fizbanoide both of these statements can be true:
But the union of those does not mean that PKCS#11 defines how to do ed25519 via PKCS#11 which the current version of the specification does not. This means that each vendor, should it wish to support ed25519 via PKCS#11 will do so via proprietary extensions to PKCS#11. As a result, no common code that works cross-vendor can be made that works with this capability, it also means that we can not look at the PKCS#11 public specification to see how to implement the logic. It is possible in most cases to use propietary mechanisms such as the ones we are discussing via graphene, however without:
There is not much we can do; I personally would love to see ed25519 in P11, and, see it work in graphene; but without the above assets there is not much we can do. If you have a support contract with the vendor I would ask for a sample, they will provide it. Ryan |
Alright, thanks for the answer, I'll check with Thales first to see if I can get any sample. |
I found a way to generate keypairs using the curve25519 with the Thales Luna 7 Network HSM and sign some data with it. Here is the code :
I had to use the hexadecimal code for the mechanisms because they are not implemented so far on the 2.4 version of PKCS11. |
I attempted this code today with a Luna 7 and got the following error: `workspaces/micronaut-devcontainer/graphene/node_modules/graphene-pk11/build/cjs/session.js:193 TypeError: Cannot read property 'toUpperCase' of undefined I assume it doesn't like the hex mechanism with out some additional code changes. |
Mechanism.vendor("CustomName", 0x80000c01); But I think it's an issue. |
I opened issue #144 to solve the mechanism problem |
@zosocanuck I published the new version. Please try |
For the ones running into this same issue, one can use raw values like this to support ed25519 signing using graphene: Also note that update() is not supported for ed25519 keys and signing has to be done once only. And SoftHSM2 needs to be configured and compiled locally with the following flags:
|
@sonkkeli, your code is working and I get keypair using the ed25519 algo. But can I get this key in Solana blockchain keypair format? Below is the code.
|
Hello,
I'd like to use this lib to first generate a Ed25519 keypair on HSM. I know that OpenSSL currently supports Ed25519, but i can't find it in the list of curve names here. Is there any way to create a keypair with Ed25519 ?
The text was updated successfully, but these errors were encountered: