####################################################
#
-# 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.
return output[0].strip()
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
####################################################
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'")
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 != "":