Skip to content
Snippets Groups Projects
Commit e0c1e9d7 authored by nimrod's avatar nimrod
Browse files

Rename find_cert_by_hash to find_cert_by_issuer_hash, sync docs.

parent 9d28e0f8
Branches
No related tags found
No related merge requests found
......@@ -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).
......
......@@ -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 ..
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment