aboutsummaryrefslogtreecommitdiffstats
path: root/tests/oom-platform-cert-service/truststoremerger/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'tests/oom-platform-cert-service/truststoremerger/libraries')
-rw-r--r--tests/oom-platform-cert-service/truststoremerger/libraries/JksTruststoreValidator.py18
-rw-r--r--tests/oom-platform-cert-service/truststoremerger/libraries/JksValidator.py28
2 files changed, 28 insertions, 18 deletions
diff --git a/tests/oom-platform-cert-service/truststoremerger/libraries/JksTruststoreValidator.py b/tests/oom-platform-cert-service/truststoremerger/libraries/JksTruststoreValidator.py
deleted file mode 100644
index e18ca12c..00000000
--- a/tests/oom-platform-cert-service/truststoremerger/libraries/JksTruststoreValidator.py
+++ /dev/null
@@ -1,18 +0,0 @@
-
-import jks
-
-class JksTruststoreValidator:
-
- def get_truststore(self, truststore_path, password_path):
- truststore = jks.KeyStore.load(truststore_path, open(password_path, 'rb').read())
- return truststore.certs
-
- def assert_jks_truststores_equal(self, result_truststore_path, password_path, expected_truststore_path):
- result_certs = self.get_truststore(result_truststore_path, password_path)
- expected_certs = self.get_truststore(expected_truststore_path, password_path)
- if len(result_certs) != len(expected_certs):
- return False
- for k in result_certs:
- if not (k in expected_certs and result_certs[k].cert == expected_certs[k].cert):
- return False
- return True
diff --git a/tests/oom-platform-cert-service/truststoremerger/libraries/JksValidator.py b/tests/oom-platform-cert-service/truststoremerger/libraries/JksValidator.py
new file mode 100644
index 00000000..983f66bb
--- /dev/null
+++ b/tests/oom-platform-cert-service/truststoremerger/libraries/JksValidator.py
@@ -0,0 +1,28 @@
+
+import jks
+
+class JksValidator:
+
+ def get_jks_entries(self, jks_path, password_path):
+ store = jks.KeyStore.load(jks_path, open(password_path, 'rb').read())
+ return store.entries
+
+ def assert_jks_truststores_equal(self, result_truststore_path, password_path, expected_truststore_path):
+ result_keys = self.get_jks_entries(result_truststore_path, password_path)
+ expected_keys = self.get_jks_entries(expected_truststore_path, password_path)
+ if len(result_keys) != len(expected_keys):
+ return False
+ for k in result_keys:
+ if not (k in expected_keys and result_keys[k].cert == expected_keys[k].cert):
+ return False
+ return True
+
+ def assert_jks_keystores_equal(self, result_keystore_path, password_path, expected_keystore_path):
+ result_keys = self.get_jks_entries(result_keystore_path, password_path)
+ expected_keys = self.get_jks_entries(expected_keystore_path, password_path)
+ if len(result_keys) != len(expected_keys):
+ return False
+ for k in result_keys:
+ if not (k in expected_keys and result_keys[k].pkey == expected_keys[k].pkey):
+ return False
+ return True