Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
e07795e8
Commit
e07795e8
authored
Jan 11, 2022
by
neil
Browse files
fix
https://github.com/acmesh-official/acme.sh/issues/3883
parent
bda454fe
Changes
1
Show whitespace changes
Inline
Side-by-side
acme.sh
View file @
e07795e8
...
@@ -1631,6 +1631,24 @@ _stat() {
...
@@ -1631,6 +1631,24 @@ _stat() {
return 1 #error, 'stat' not found
return 1 #error, 'stat' not found
}
}
#keyfile
_isRSA() {
keyfile=$1
if grep "BEGIN RSA PRIVATE KEY" "$keyfile" >/dev/null 2>&1 || ${ACME_OPENSSL_BIN:-openssl} rsa -in "$keyfile" -noout -text | grep "^publicExponent:" >/dev/null 2>&1; then
return 0
fi
return 1
}
#keyfile
_isEcc() {
keyfile=$1
if grep "BEGIN EC PRIVATE KEY" "$keyfile" >/dev/null 2>&1 || ${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^NIST CURVE:" >/dev/null 2>&1; then
return 0
fi
return 1
}
#keyfile
#keyfile
_calcjwk() {
_calcjwk() {
keyfile="$1"
keyfile="$1"
...
@@ -1644,7 +1662,7 @@ _calcjwk() {
...
@@ -1644,7 +1662,7 @@ _calcjwk() {
return 0
return 0
fi
fi
if
grep "BEGIN RSA PRIVATE KEY" "$keyfile" >/dev/null 2>&1
; then
if
_isRSA "$keyfile"
; then
_debug "RSA key"
_debug "RSA key"
pub_exp=$(${ACME_OPENSSL_BIN:-openssl} rsa -in "$keyfile" -noout -text | grep "^publicExponent:" | cut -d '(' -f 2 | cut -d 'x' -f 2 | cut -d ')' -f 1)
pub_exp=$(${ACME_OPENSSL_BIN:-openssl} rsa -in "$keyfile" -noout -text | grep "^publicExponent:" | cut -d '(' -f 2 | cut -d 'x' -f 2 | cut -d ')' -f 1)
if [ "${#pub_exp}" = "5" ]; then
if [ "${#pub_exp}" = "5" ]; then
...
@@ -1666,7 +1684,7 @@ _calcjwk() {
...
@@ -1666,7 +1684,7 @@ _calcjwk() {
JWK_HEADER='{"alg": "RS256", "jwk": '$jwk'}'
JWK_HEADER='{"alg": "RS256", "jwk": '$jwk'}'
JWK_HEADERPLACE_PART1='{"nonce": "'
JWK_HEADERPLACE_PART1='{"nonce": "'
JWK_HEADERPLACE_PART2='", "alg": "RS256"'
JWK_HEADERPLACE_PART2='", "alg": "RS256"'
elif
grep "BEGIN EC PRIVATE KEY" "$keyfile" >/dev/null 2>&1
; then
elif
_isEcc "$keyfile"
; then
_debug "EC key"
_debug "EC key"
crv="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^NIST CURVE:" | cut -d ":" -f 2 | tr -d " \r\n")"
crv="$(${ACME_OPENSSL_BIN:-openssl} ec -in "$keyfile" -noout -text 2>/dev/null | grep "^NIST CURVE:" | cut -d ":" -f 2 | tr -d " \r\n")"
_debug3 crv "$crv"
_debug3 crv "$crv"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment