diff --git a/README.rst b/README.rst index 024b057cd445644a889786e499f935de5baac031..a30747cdf77df1ecfc9ad8ed78639d5c9f478551 100644 --- a/README.rst +++ b/README.rst @@ -47,8 +47,9 @@ Shell functions - issuer_hash: Returns OpenSSL's hash of the cert's issuer. - find_root_cert: Return the filename of the (first) root (self-signed) certificate of the filenames passed as parameters. -- find_cert_by_hash: Gets a hash and a list of filenames, returns the - filename of the certificate with that subject hash. +- find_cert_by_issuer_hash: Gets a hash and a list of filenames, returns the + filename of the certificate with that issuer hash. Ignores self-signed (root + CA) certificates. - unbudle_cert: Gets a filename, creates a directory named :code:`certs` which contains all of the individual certs in the file (the files are named by their subject hash). diff --git a/bundle_certs b/bundle_certs index 948c91c2cd8ebe940a2812d4e90e7fae7a291cae..2f79e3f955107076061ab38b502127faac800bc7 100755 --- a/bundle_certs +++ b/bundle_certs @@ -23,9 +23,10 @@ find_root_cert () { done } -find_cert_by_hash () { - # Recieves the issuer hash and a list of file paths, returns the path to - # the certificate which was issued by that hash. +find_cert_by_issuer_hash () { + # Gets a hash and a list of filenames, returns the + # filename of the certificate with that issuer hash. Ignores self-signed + # (root CA) certificates. certhash="$1" shift for filename in "$@" @@ -66,12 +67,12 @@ bundle_certs () { echo "Failed to find root certificate." > /dev/stderr exit 1 fi - issued="$(find_cert_by_hash $issuer *)" + issued="$(find_cert_by_issuer_hash $issuer *)" while [ -n "$issued" ] do ordered_certs="$issued $ordered_certs" issuer="$issued" - issued="$(find_cert_by_hash $issuer *)" + issued="$(find_cert_by_issuer_hash $issuer *)" done cat $ordered_certs cd ..