-
Notifications
You must be signed in to change notification settings - Fork 18k
x/crypto/openpgp: Cannot encrypt with ECDSA #30388
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
Comments
CC @bradfitz @FiloSottile @agl for (See also the lengthy discussion of the future of |
DSA stands for Digital Signature Algorithm. You can only sign with it, not encrypt, if I don't misunderstand the issue. |
We can make some encryption with ECC. |
@samuel-uniris , I don't think even gpg will accept a key such as the one you made in your example code. You can add code to write out the public key, import it in gpg and see what it says. It is true that there there are specifications for encrypting with ECC in OpenPGP (RFC6637). I'm no expert, but I couldn't find a way to do this with x/crypto/openpgp (see my attempt: #22015 (comment)). Can you tell a bit more about what you are trying to achieve? Do you need to interoperate with PGP, or do you just need to encrypt messages or files within your application or system? In case you don't need to interoperate with PGP, there are more modern libraries that are much easier and safer to use. See for instance nacl/box or saltpack. |
Actually I implemented an ECIES using ECDSA with x509 standard and wanted to do the same with OpenPGP standard . But maybe the lib is outdated or no Gpg2 compliant. |
It might be interesting to have this. If I find the time, I might have a go. Though right now it's not quite clear how that works - AIUI the question of maintainership of x/crypto/openpgp isn't fully settled. |
Per the accepted #44226 proposal and due to lack of maintenance, the golang.org/x/crypto/openpgp package is now frozen and deprecated. No new changes will be accepted except for security fixes. The package will not be removed. If this is a security issue, please email [email protected] and we will assess it and provide a fix. If you're looking for alternatives, consider the crypto/ed25519 package for simple signatures, golang.org/x/mod/sumdb/note for inline signatures, or filippo.io/age for encryption. You can read a summary of OpenPGP issues and alternatives here. If you are required to interoperate with OpenPGP systems and need a maintained package, we suggest considering one of multiple community forks of golang.org/x/crypto/openpgp. We don't endorse any specific one. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I created a ECDSA key based on the crypto/elliptic package.
Then I used it with openpgp:
packet.NewECDSAPrivateKey(time.Now(), key)
Then I created an entity
Then I tried to encrypt using this entity
And I got this error: openpgp: unsupported feature: encrypting a key to public key of type 19
After searching in the codebase, I found that Encrypt call the method SerializeEncryptedKey which not handle ECDSA keys
The text was updated successfully, but these errors were encountered: