Giter Site home page Giter Site logo

Comments (9)

yichengq avatar yichengq commented on August 26, 2024

empty passphrase is still a valid passphrase.
If you wanna export the unencrpted key file, you can use export --insecure

from etcd-ca.

abourget avatar abourget commented on August 26, 2024

the message shown says Enter passphrase (empty for no passphrase):.. I'd expect no passphrase to mean there is no passphrase, like not encrypted.. that's what openssl would do.

In this case, when you hit enter for an empty passphrase, the key still gets encrypted. With what passphrase ? I don't know, but I know you can't decrypt it with openssl, because it will ask for a minimum of 4 characters. I don't know if it's a constraint by the encryption scheme or only by the openssl UI, but it makes the generated certificates useless in this case.

from etcd-ca.

abourget avatar abourget commented on August 26, 2024

Here's a small patch that implements what I mean:

diff --git a/cmd/new_cert.go b/cmd/new_cert.go
index 125458b..eacaeca 100644
--- a/cmd/new_cert.go
+++ b/cmd/new_cert.go
@@ -70,7 +70,13 @@ func newCertAction(c *cli.Context) {
        if err = depot.PutCertificateSigningRequest(d, name, csr); err != nil {
                fmt.Fprintln(os.Stderr, "Save certificate request error:", err)
        }
-       if err = depot.PutEncryptedPrivateKeyHost(d, name, key, passphrase); err != nil {
-               fmt.Fprintln(os.Stderr, "Save key error:", err)
+       if len(passphrase) == 0 {
+               if err = depot.PutPrivateKeyHost(d, name, key); err != nil {
+                       fmt.Fprintln(os.Stderr, "Save key error:", err)
+               }
+       } else {
+               if err = depot.PutEncryptedPrivateKeyHost(d, name, key, passphrase); err != nil {
+                       fmt.Fprintln(os.Stderr, "Save key error:", err)
+               }
        }
 }

Would that be useful ?

from etcd-ca.

yichengq avatar yichengq commented on August 26, 2024

@abourget It can be encrypted with empty passphrase. I would prefer to fix the print message.
You can still export unencrypted key easily using export --insecure

from etcd-ca.

abourget avatar abourget commented on August 26, 2024

ok. I see I can export with export --insecure, which outputs a .tar file.. that's a first inconvenience for me.. as I wouldn't want to deal with the .tar .. only picking up a .key file.

For consistency with openssl, I would have liked to have the same behavior here too.. I was surprised (in a bad way) when I saw the key was encrypted with a blank passphrase. Why create bad surprises ?

Anyway, I've made my points. I'll close this issue until someone wants to pick it up. Thanks

from etcd-ca.

yichengq avatar yichengq commented on August 26, 2024

After rethinking about it, i think it should keep the same convention as openssh one. I will improve it later.

from etcd-ca.

abourget avatar abourget commented on August 26, 2024

what about my patch up here ? I stumbled upon this one once again :)

from etcd-ca.

abourget avatar abourget commented on August 26, 2024

I can make it a PR if you want.

from etcd-ca.

bkleef avatar bkleef commented on August 26, 2024

Can we please merge this. This would be very useful because Alpine Linux 3.2 x64 doesn't get the tar -e option and IMHO it's just useless to tar something to extract it directly afterwards.

from etcd-ca.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.