-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Porting changes from ounsworth/pqc-cert-checker
- Loading branch information
Showing
3 changed files
with
64 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<title>PQC Artifact Test Results</title> | ||
</head> | ||
<body> | ||
<p><a href="/pqc_hackathon_results_certs_r3.html">pqc_hackathon_results_certs_r3.html</a></p> | ||
<p><a href="/pqc_hackathon_results_certs_r3.html">pqc_hackathon_results_certs_r3_automated_tests.html</a></p> | ||
<p><a href="/pqc_hackathon_results_cms_v1.html">pqc_hackathon_results_cms_v1.html</a></p> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/bin/sh | ||
|
||
certszipr3="artifacts_certs_r3.zip" | ||
cmszipr1="artifacts_cms_v1.zip" | ||
inputdir="./providers" | ||
outputdir="./output/certs" | ||
|
||
# Requires an input: the TA file to test | ||
test_ta () { | ||
tafile=$1 | ||
resultsfile=$2 | ||
|
||
printf "\nTesting %s\n" $tafile | ||
|
||
# openssl always exits with 0, so we can't use exit status to tell if the cert was valid :/ | ||
ossl_output=$(openssl x509 -in $tafile -text -noout 2>&1) | ||
|
||
# print it out for the logs | ||
echo "$ossl_output" | ||
|
||
tafileBasename=$(basename $tafile) | ||
oid=${tafileBasename%_ta.pem} # remove the suffix "_ta.pem" | ||
|
||
# test for an error | ||
if (echo $ossl_output | grep "error\|Unable\|Error" >/dev/null); then | ||
echo "Certificate Validation Result: FAIL" | ||
echo $oid,N >> $resultsfile | ||
else | ||
echo "Certificate Validation Result: SUCCESS" | ||
echo $oid,Y >> $resultsfile | ||
fi | ||
} | ||
|
||
# First, recurse into any provider dir | ||
for providerdir in $(ls -d $inputdir/*/); do | ||
provider=$(basename $providerdir) | ||
|
||
# process certs | ||
zip=$providerdir/$certszipr3 | ||
printf "Unziping %s\n" $zip | ||
unzip -o $zip -d "artifacts_certs_r3" | ||
|
||
# Start the results CSV file | ||
mkdir -p $outputdir | ||
resultsfile=$outputdir/${provider}_oqsprovider.csv | ||
echo "key_algorithm_oid,test_result" > $resultsfile | ||
|
||
# test each TA file | ||
for tafile in $(ls artifacts_certs_r3/*_ta.pem); do | ||
test_ta "$tafile" "$resultsfile" | ||
done | ||
done | ||
|