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

PGP key creation with passphrase #4

Open
monirz opened this issue Aug 8, 2018 · 7 comments
Open

PGP key creation with passphrase #4

monirz opened this issue Aug 8, 2018 · 7 comments

Comments

@monirz
Copy link

monirz commented Aug 8, 2018

Hello, is there a way creating PGP key with password using this package? Or is it even possible with OpenPGP package from Golang? I do not see any option for that. What I need is create a PGP key with password like what GnuPG/GPG tool does and later the password will be used for verifying the PGP key when someone will try to use it. So is there a way that I can achieve this using Golang instead of using GPG tool to generate the key? Thank you!

@alokmenghrajani
Copy link
Owner

gpgeez.CreateKey does not currently support password/passphrases. Feel free to open a PR if you are able to, it would be a perfect fit as a wrapper around the underlying library.

You'll need to check https://godoc.org/golang.org/x/crypto/openpgp#NewEntity to see if it supports passwords/passphrases.

@monirz
Copy link
Author

monirz commented Aug 8, 2018

I think openpgp does not support password/passphrase I aslo talked to the Go's official IRC channel they ensured about that but I'm looking for some workaround, if we still could use openpgp from standard library since we are using Go, thanks!

@fawkesley
Copy link

We're also interested in this for https://github.com/fluidkeys/fluidkeys, we're going to spend some time today working on this, will let you know how we get on :)

@monirz
Copy link
Author

monirz commented Aug 17, 2018

That's great, let me know if you got any progress on that, thanks!

@fawkesley
Copy link

@monirz This has proven much more difficult than I anticipated but today we successfully exported an RSA key (& subkey) with an encryption passphrase foo, and successfully imported it back into GnuPG.

I had to fork golang/crypto to do this, and the code is a mess right now but tomorrow I'll clean it up (on our own fork) and in the next few weeks I'll submit pull requests back to golang/crypto and alokmenghrajani/gpgeez

If you're interested the key is below!

-----BEGIN PGP PRIVATE KEY BLOCK-----

                xcFGBFt8UWEBBADz4upzhTfAbMzQJ79m/HzTYrAD8hBxBTOJPM3P1I+hBU4tD0H7
                jg3zMXiTG0wAWVZlOlcPxH+LOcyOsMX+oLVrrC8BQqUGMWi5i63PYfPXXF2PFbax
                GYBjqYZSTTVdH2iojx02zJh0dKr/ux/N/j56jNMDjrFqY5G8DQt9GHbcjwARAQAB
                /gcDAoRTDYiqbSTMYAoNurasH/DecSlI5XvTeQfl+0xtu6CEnorS5k7mRPlGsWlW
                Bj7iA6nUQmRdnUkLE3EAP2X0dDv9iOQy2ryxpRq0GT6RtpHxkTxgHr8w45IQCTzw
                0jETQA2jGICDm7+0PlWqAFmBxuy4GoixTCBZZp9L8eHcB1zG6wvU0ZfyXti+T9wU
                vv9odqDewEDJJ3OY2oZH/4h0MMKbzcXxA5Oc/nhLQVGshgD7faGFApNO4poUXLfQ
                AhJ4NFrM3cd46S50sjJPB5UBInpAFBFaLM9K/Oo1RiOxHGL8T65rlJypP/aHG338
                rX+TNf32sSzVRDAM3igj1QlKfTL0Dnqzmi86OhoUCnySJOzAqp8JNBAc14zLOclR
                0/1Z3iFf+3eODSf+wq8pVLFH0ktssYnhNgv2rC7uvsN/TQ4sKJ0ryfstY0z5a2hG
                IfOteF4e5+IsPyqwv9zYZIQBgiFe6S+Ggcka+7imsITftqo3DPpKWjbNI1Rlc3Qg
                VXNlciAodGVzdCkgPHRlc3RAZXhhbXBsZS5jb20+wqIEEwEIABYFAlt8UWEJEKLp
                OqfZBkA0AhsDAhkBAAC6mQQAMJ2NL7JnGtKH0asxmDYNzLrumFtCCuozOzW7kD4a
                Ypd8wI/o6Rpo5IgTFrd8MIHRaBi56p0JSqHTqxhj26/2GUbQmN4Hw65s6qcjl+j8
                EPFqe3zq85MCE7KuRHrsX125uu53XLKwrVwBnD6Ou0+T/zdO6w4sdbKIqRJrtTw0
                WOLHwUYEW3xRYQEEALNsgphbcGYdA1qRb1FADxZHhUJjxMdjL49UTMvyvTsXv0OF
                f7FKwcjziGWdS81YCZCeczEpfTzatKOCQdh9vsJTyFZ3Hw1+flLxgktcWX+MWhee
                0Trvg5RWLMYSm9uBeg4IfCsX1S2ekbp++EIwUaBVxsno38TtARQgEUzvf/wVABEB
                AAH+BwMCNaLsII/BPlZgSpFugjZF2IQctvM22jThD36N8VOZ2F7+WiZ6FjWMzoBX
                W4R457ZHrQ1LbsWyucBTCI0KqP4+gkSvDnHCVZ14r5HuUOk9asfKUgDAJhf+r/AU
                JqH59hYe0LKUkkM+lUXJWCSdLyuIFxEEQ6YET6f3a0wXHPTventJXdA11iK18X3K
                rZ/SW4MFiRTdSFUrAMVMY7v1ujwBfv6bDcYF+7kuQJwJJ+zqfuop/oaaaPJS2nsQ
                3WzO74vp5hmI0BsD0tgSFFMTvcUJQddJ9eej1Koz//V+R5eh71/N7fMsPkulqsGK
                Ey2Sodql715npghvz08Sar+WcSD5pPFFg6kAlMrBUK+bq09fhbf1ID4/LoMf9oKu
                iEYickuOP/hr5kazkofkkON35fM1636c62/T9anh1OR6Q06K1fVMYjer+whXpRl5
                nlT9ItyYZ9H5Us6TDpMZk9Vc6Okktld9sJKUVEIjwsGHkCjxCnXnEARMg8KfBBgB
                CAATBQJbfFFhCRCi6Tqn2QZANAIbDAAAV8YEAMifiridMbpmlPia1XDISB8uGB7u
                5HqjtLK8QpZcDUps+C7+VOM03yqs3Ma/sL5YjHIhA9W2fH5/Jut8K6GbEos/upQm
                bcZmOSqYo+sQ2wnwmwLAsjNYYjbht10eHZPfClYm0dJRArfDoE1q1lMrEU3ugFhu
                QiFhRI9Ye7FIxK7s
                =Av9Q
                -----END PGP PRIVATE KEY BLOCK-----

@alokmenghrajani
Copy link
Owner

Thanks for the update, looking forward to the PR.

@fdefilippo
Copy link

@monirz This has proven much more difficult than I anticipated but today we successfully exported an RSA key (& subkey) with an encryption passphrase foo, and successfully imported it back into GnuPG.

I had to fork golang/crypto to do this, and the code is a mess right now but tomorrow I'll clean it up (on our own fork) and in the next few weeks I'll submit pull requests back to golang/crypto and alokmenghrajani/gpgeez

If you're interested the key is below!

-----BEGIN PGP PRIVATE KEY BLOCK-----

                xcFGBFt8UWEBBADz4upzhTfAbMzQJ79m/HzTYrAD8hBxBTOJPM3P1I+hBU4tD0H7
                jg3zMXiTG0wAWVZlOlcPxH+LOcyOsMX+oLVrrC8BQqUGMWi5i63PYfPXXF2PFbax
                GYBjqYZSTTVdH2iojx02zJh0dKr/ux/N/j56jNMDjrFqY5G8DQt9GHbcjwARAQAB
                /gcDAoRTDYiqbSTMYAoNurasH/DecSlI5XvTeQfl+0xtu6CEnorS5k7mRPlGsWlW
                Bj7iA6nUQmRdnUkLE3EAP2X0dDv9iOQy2ryxpRq0GT6RtpHxkTxgHr8w45IQCTzw
                0jETQA2jGICDm7+0PlWqAFmBxuy4GoixTCBZZp9L8eHcB1zG6wvU0ZfyXti+T9wU
                vv9odqDewEDJJ3OY2oZH/4h0MMKbzcXxA5Oc/nhLQVGshgD7faGFApNO4poUXLfQ
                AhJ4NFrM3cd46S50sjJPB5UBInpAFBFaLM9K/Oo1RiOxHGL8T65rlJypP/aHG338
                rX+TNf32sSzVRDAM3igj1QlKfTL0Dnqzmi86OhoUCnySJOzAqp8JNBAc14zLOclR
                0/1Z3iFf+3eODSf+wq8pVLFH0ktssYnhNgv2rC7uvsN/TQ4sKJ0ryfstY0z5a2hG
                IfOteF4e5+IsPyqwv9zYZIQBgiFe6S+Ggcka+7imsITftqo3DPpKWjbNI1Rlc3Qg
                VXNlciAodGVzdCkgPHRlc3RAZXhhbXBsZS5jb20+wqIEEwEIABYFAlt8UWEJEKLp
                OqfZBkA0AhsDAhkBAAC6mQQAMJ2NL7JnGtKH0asxmDYNzLrumFtCCuozOzW7kD4a
                Ypd8wI/o6Rpo5IgTFrd8MIHRaBi56p0JSqHTqxhj26/2GUbQmN4Hw65s6qcjl+j8
                EPFqe3zq85MCE7KuRHrsX125uu53XLKwrVwBnD6Ou0+T/zdO6w4sdbKIqRJrtTw0
                WOLHwUYEW3xRYQEEALNsgphbcGYdA1qRb1FADxZHhUJjxMdjL49UTMvyvTsXv0OF
                f7FKwcjziGWdS81YCZCeczEpfTzatKOCQdh9vsJTyFZ3Hw1+flLxgktcWX+MWhee
                0Trvg5RWLMYSm9uBeg4IfCsX1S2ekbp++EIwUaBVxsno38TtARQgEUzvf/wVABEB
                AAH+BwMCNaLsII/BPlZgSpFugjZF2IQctvM22jThD36N8VOZ2F7+WiZ6FjWMzoBX
                W4R457ZHrQ1LbsWyucBTCI0KqP4+gkSvDnHCVZ14r5HuUOk9asfKUgDAJhf+r/AU
                JqH59hYe0LKUkkM+lUXJWCSdLyuIFxEEQ6YET6f3a0wXHPTventJXdA11iK18X3K
                rZ/SW4MFiRTdSFUrAMVMY7v1ujwBfv6bDcYF+7kuQJwJJ+zqfuop/oaaaPJS2nsQ
                3WzO74vp5hmI0BsD0tgSFFMTvcUJQddJ9eej1Koz//V+R5eh71/N7fMsPkulqsGK
                Ey2Sodql715npghvz08Sar+WcSD5pPFFg6kAlMrBUK+bq09fhbf1ID4/LoMf9oKu
                iEYickuOP/hr5kazkofkkON35fM1636c62/T9anh1OR6Q06K1fVMYjer+whXpRl5
                nlT9ItyYZ9H5Us6TDpMZk9Vc6Okktld9sJKUVEIjwsGHkCjxCnXnEARMg8KfBBgB
                CAATBQJbfFFhCRCi6Tqn2QZANAIbDAAAV8YEAMifiridMbpmlPia1XDISB8uGB7u
                5HqjtLK8QpZcDUps+C7+VOM03yqs3Ma/sL5YjHIhA9W2fH5/Jut8K6GbEos/upQm
                bcZmOSqYo+sQ2wnwmwLAsjNYYjbht10eHZPfClYm0dJRArfDoE1q1lMrEU3ugFhu
                QiFhRI9Ye7FIxK7s
                =Av9Q
                -----END PGP PRIVATE KEY BLOCK-----

hi, where can i find the code?

thnx

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

4 participants