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
No related branches found
No related tags found
No related merge requests found
...@@ -47,8 +47,9 @@ Shell functions ...@@ -47,8 +47,9 @@ Shell functions
- issuer_hash: Returns OpenSSL's hash of the cert's issuer. - issuer_hash: Returns OpenSSL's hash of the cert's issuer.
- find_root_cert: Return the filename of the (first) root (self-signed) - find_root_cert: Return the filename of the (first) root (self-signed)
certificate of the filenames passed as parameters. certificate of the filenames passed as parameters.
- find_cert_by_hash: Gets a hash and a list of filenames, returns the - find_cert_by_issuer_hash: Gets a hash and a list of filenames, returns the
filename of the certificate with that subject hash. 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 - 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 contains all of the individual certs in the file (the files are named by their
subject hash). subject hash).
......
...@@ -23,9 +23,10 @@ find_root_cert () { ...@@ -23,9 +23,10 @@ find_root_cert () {
done done
} }
find_cert_by_hash () { find_cert_by_issuer_hash () {
# Recieves the issuer hash and a list of file paths, returns the path to # Gets a hash and a list of filenames, returns the
# the certificate which was issued by that hash. # filename of the certificate with that issuer hash. Ignores self-signed
# (root CA) certificates.
certhash="$1" certhash="$1"
shift shift
for filename in "$@" for filename in "$@"
...@@ -66,12 +67,12 @@ bundle_certs () { ...@@ -66,12 +67,12 @@ bundle_certs () {
echo "Failed to find root certificate." > /dev/stderr echo "Failed to find root certificate." > /dev/stderr
exit 1 exit 1
fi fi
issued="$(find_cert_by_hash $issuer *)" issued="$(find_cert_by_issuer_hash $issuer *)"
while [ -n "$issued" ] while [ -n "$issued" ]
do do
ordered_certs="$issued $ordered_certs" ordered_certs="$issued $ordered_certs"
issuer="$issued" issuer="$issued"
issued="$(find_cert_by_hash $issuer *)" issued="$(find_cert_by_issuer_hash $issuer *)"
done done
cat $ordered_certs cat $ordered_certs
cd .. cd ..
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment