summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Swierczek <t.swierczek@samsung.com>2024-01-15 13:25:08 +0100
committerTomasz Swierczek <t.swierczek@samsung.com>2024-01-15 13:28:37 +0100
commita732a13d3da8aa8fb68bcc57b7c97c1f78f07717 (patch)
tree2abc7f0a3a321a8c555689e275577fc517b23efe
parent3fc5514e471828ef268762c8782277a48361f756 (diff)
downloadca-certificates-tizen.tar.gz
ca-certificates-tizen.tar.bz2
ca-certificates-tizen.zip
No need to check if file is a cert AND separately calculate SHA1 Change-Id: I031d674ff35db828e9afce6dff2e47edb2742add
-rwxr-xr-xscripts/merge-certs-info.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/scripts/merge-certs-info.py b/scripts/merge-certs-info.py
index e7ab2b8..c6b105b 100755
--- a/scripts/merge-certs-info.py
+++ b/scripts/merge-certs-info.py
@@ -1,6 +1,6 @@
####################################################
#
-# Copyright (c) 2018 - 2023 Samsung Electronics Co., Ltd All Rights Reserved
+# Copyright (c) 2018 - 2024 Samsung Electronics Co., Ltd All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -67,12 +67,6 @@ def getEndDate(path):
return ""
####################################################
-# Returns true if path points to certificate file
-####################################################
-def isCert(path):
- return len(consoleCommand("openssl x509 -in " + path + " -subject_hash_old -noout")) > 0;
-
-####################################################
# Returns true if certificate under path is not expired
####################################################
def isCertValid(path):
@@ -80,7 +74,7 @@ def isCertValid(path):
return endDate > datetime.now()
####################################################
-# Returns sha1 fingerprint of DER or PEM cert, empty string on error
+# Returns sha1 fingerprint of DER or PEM cert, empty string on error (ie. file is not a certificate)
####################################################
def calculateCertSHA1(path):
output = consoleCommand("openssl x509 -noout -fingerprint -sha1 -inform pem -in " + path + " | sed -e 's/Fingerprint=//g'")
@@ -154,11 +148,11 @@ for directory in directories:
files = consoleCommand("ls -1 " + directory)
for f in files:
f = f.strip()
- if isCert(directory + "/" + f):
- sha1 = calculateCertSHA1(directory + "/" + f)
- if len(sha1) > 0:
- sha1ToName[sha1] = f;
- allSha1ToAnyPath[sha1] = directory + "/" + f
+ path = directory + "/" + f
+ sha1 = calculateCertSHA1(path)
+ if len(sha1) > 0:
+ sha1ToName[sha1] = f;
+ allSha1ToAnyPath[sha1] = path
dirToSha1ToName[directory] = sha1ToName;
if outputDir != "":