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

Add nopass parameter to export-p12 #46

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,9 @@ cmd_help() {
export-p12 <filename_base> [ cmd-opts ]
Export a PKCS#12 file with the keypair specified by <filename_base>"
opts="
noca - do not include the ca.crt file in the PKCS12 output
nokey - do not include the private key in the PKCS12 output" ;;
noca - do not include the ca.crt file in the PKCS12 output
nokey - do not include the private key in the PKCS12 output
nopass - use blank password" ;;
export-p7) text="
export-p7 <filename_base> [ cmd-opts ]
Export a PKCS#7 file with the pubkey specified by <filename_base>"
Expand Down Expand Up @@ -785,10 +786,12 @@ Run easyrsa without commands for usage and command help."
# opts support
local want_ca=1
local want_key=1
local want_pass=1
while [ -n "$1" ]; do
case "$1" in
noca) want_ca= ;;
nokey) want_key= ;;
nopass) want_pass= ;;
*) warn "Ignoring unknown command option: '$1'" ;;
esac
shift
Expand Down Expand Up @@ -820,6 +823,10 @@ Missing key expected at: $key_in"
pkcs_opts="$pkcs_opts -nokeys"
fi

if [ ! $want_pass ]; then
TinCanTech marked this conversation as resolved.
Show resolved Hide resolved
pkcs_opts="$pkcs_opts -password pass:"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should be -nodes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it shouldn't. This modification allows you to export encrypted pkcs12 with no (blank) password.

fi

# export the p12:
"$EASYRSA_OPENSSL" pkcs12 -in "$crt_in" -inkey "$key_in" -export \
-out "$pkcs_out" $pkcs_opts || die "\
Expand Down