From 2104171af0c7601bebefc03648612610cb96ba16 Mon Sep 17 00:00:00 2001 From: Imelstorm Date: Tue, 22 Jan 2019 16:15:49 +0200 Subject: [PATCH 1/2] Update compatibility data content Changed key fingerprint algorithm Updated tests for new changes --- virgil_crypto/crypto.py | 17 +++- virgil_crypto/tests/compatibility_test.py | 4 + virgil_crypto/tests/crypto_test.py | 86 ++++++++++++++++++- .../tests/data/sdk_compatibility_data.json | 71 +++++++-------- 4 files changed, 136 insertions(+), 42 deletions(-) diff --git a/virgil_crypto/crypto.py b/virgil_crypto/crypto.py index 3e2e56b..a01aa0e 100644 --- a/virgil_crypto/crypto.py +++ b/virgil_crypto/crypto.py @@ -57,6 +57,7 @@ class VirgilCrypto(object): """ def __init__(self): self.signature_hash_algorithm = HashAlgorithm.SHA512 + self.use_sha256_fingerprints = False self.key_pair_type = KeyPairType.Default _CUSTOM_PARAM_KEY_SIGNATURE = None @@ -400,7 +401,13 @@ def calculate_fingerprint(self, data): Returns: Fingerprint of the source data. """ - hash_data = self.compute_hash(data, HashAlgorithm.SHA256) + if self.use_sha256_fingerprints: + hash_algorithm = HashAlgorithm.SHA256 + hash_data = self.compute_hash(data, hash_algorithm) + else: + hash_algorithm = HashAlgorithm.SHA512 + hash_data = self.compute_hash(data, hash_algorithm)[0:8] + return Fingerprint(hash_data) @staticmethod @@ -431,7 +438,13 @@ def compute_public_key_hash(self, public_key): Hash bytes. """ public_key_der = VirgilKeyPair.publicKeyToDER(public_key) - return self.compute_hash(public_key_der, HashAlgorithm.SHA256) + if self.use_sha256_fingerprints: + hash_algorithm = HashAlgorithm.SHA256 + computed_hash = self.compute_hash(public_key_der, hash_algorithm) + else: + hash_algorithm = HashAlgorithm.SHA512 + computed_hash = self.compute_hash(public_key_der, hash_algorithm)[0:8] + return computed_hash @property def custom_param_key_signature(self): diff --git a/virgil_crypto/tests/compatibility_test.py b/virgil_crypto/tests/compatibility_test.py index f22c168..2549c30 100644 --- a/virgil_crypto/tests/compatibility_test.py +++ b/virgil_crypto/tests/compatibility_test.py @@ -53,12 +53,14 @@ def __init__(self, *args, **kwargs): self.__crypto = None def test_encrypt_single_recipient(self): + self._crypto.use_sha256_fingerprints = True data = self._compatibility_data["encrypt_single_recipient"] private_key = self._crypto.import_private_key(data["private_key"]) decrypted_data = self._crypto.decrypt(data["cipher_data"], private_key) self.assertEqual(data["original_data"], decrypted_data) def test_encrypt_multiple_recipients(self): + self._crypto.use_sha256_fingerprints = True data = self._compatibility_data["encrypt_multiple_recipients"] private_keys = [self._crypto.import_private_key(pk) for pk in data["private_keys"]] for private_key in private_keys: @@ -66,6 +68,7 @@ def test_encrypt_multiple_recipients(self): self.assertEqual(data["original_data"], decrypted_data) def test_sign_then_encrypt_single_recipient(self): + self._crypto.use_sha256_fingerprints = True data = self._compatibility_data["sign_then_encrypt_single_recipient"] private_key = self._crypto.import_private_key(data["private_key"]) public_key = self._crypto.extract_public_key(private_key) @@ -77,6 +80,7 @@ def test_sign_then_encrypt_single_recipient(self): self.assertEqual(data["original_data"], decrypted_data) def test_sign_then_encrypt_multiple_recipients(self): + self._crypto.use_sha256_fingerprints = True data = self._compatibility_data["sign_then_encrypt_multiple_recipients"] private_keys = [self._crypto.import_private_key(pk) for pk in data["private_keys"]] public_key = self._crypto.extract_public_key(private_keys[0]) diff --git a/virgil_crypto/tests/crypto_test.py b/virgil_crypto/tests/crypto_test.py index 7011524..060cade 100644 --- a/virgil_crypto/tests/crypto_test.py +++ b/virgil_crypto/tests/crypto_test.py @@ -31,11 +31,12 @@ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. - +import hashlib import io import unittest +from base64 import b64decode -from virgil_crypto import crypto +from virgil_crypto import crypto, VirgilKeyPair from virgil_crypto import VirgilCrypto from virgil_crypto.hashes import HashAlgorithm @@ -212,3 +213,84 @@ def test_calculate_fingerprint(self): fingerprint = self._crypto().calculate_fingerprint(data) self.assertTrue(fingerprint.value) self.assertIsInstance(fingerprint, crypto.Fingerprint) + + def test_private_key_identifier_is_correct(self): + # STC-33 + crypto_1 = VirgilCrypto() + key_pair_1 = crypto_1.generate_keys() + + self.assertEqual( + hashlib.sha512(bytearray(crypto_1.export_public_key(key_pair_1.public_key))).digest()[0:8], + bytearray(key_pair_1.private_key.identifier) + ) + + crypto_2 = VirgilCrypto() + crypto_2.use_sha256_fingerprints = True + key_pair_2 = crypto_2.generate_keys() + + self.assertEqual( + hashlib.sha256(bytearray(crypto_2.export_public_key(key_pair_2.public_key))).digest(), + bytearray(key_pair_2.private_key.identifier) + ) + + def test_public_key_identifier_is_correct(self): + # STC-33 + crypto_1 = VirgilCrypto() + key_pair_1 = crypto_1.generate_keys() + public_key_1 = crypto_1.extract_public_key(key_pair_1.private_key) + self.assertEqual(public_key_1.identifier, key_pair_1.public_key.identifier) + self.assertEqual(crypto_1.export_public_key(public_key_1), crypto_1.export_public_key(key_pair_1.public_key)) + self.assertEqual( + hashlib.sha512(bytearray(crypto_1.export_public_key(key_pair_1.public_key))).digest()[0:8], + bytearray(key_pair_1.public_key.identifier) + ) + + crypto_2 = VirgilCrypto() + crypto_2.use_sha256_fingerprints = True + key_pair_2 = crypto_2.generate_keys() + public_key_2 = crypto_2.extract_public_key(key_pair_2.private_key) + self.assertEqual(public_key_2.identifier, key_pair_2.public_key.identifier) + self.assertEqual(crypto_1.export_public_key(public_key_2), crypto_1.export_public_key(key_pair_2.public_key)) + self.assertEqual( + hashlib.sha256(bytearray(crypto_1.export_public_key(key_pair_2.public_key))).digest(), + bytearray(key_pair_2.public_key.identifier) + ) + + def test_private_key_is_der(self): + # STC-31 + crypto = VirgilCrypto() + key_pair_1 = crypto.generate_keys() + private_key_data_1 = crypto.export_private_key(key_pair_1.private_key) + self.assertEqual(VirgilKeyPair.privateKeyToDER(private_key_data_1), private_key_data_1) + + private_key_2_bytes = "LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1DNENBUUF3QlFZREsyVndCQ0lFSUg4bnIyV05nblkya1ZScjRValp4UnJWVGpiMW4wWGdBZkhOWE1ocVkwaVAKLS0tLS1FTkQgUFJJVkFURSBLRVktLS0tLQo=" + private_key_2 = crypto.import_private_key(bytearray(b64decode(private_key_2_bytes))) + private_key_2 = key_pair_1.private_key + private_key_2_data = crypto.export_private_key(private_key_2) + self.assertEqual(VirgilKeyPair.privateKeyToDER(private_key_2_data), private_key_2_data) + + private_key_3_bytes = "LS0tLS1CRUdJTiBFTkNSWVBURUQgUFJJVkFURSBLRVktLS0tLQpNSUdoTUYwR0NTcUdTSWIzRFFFRkRUQlFNQzhHQ1NxR1NJYjNEUUVGRERBaUJCQ3kzSkk3V0VDcGVHZGFIdEc2CktHcjRBZ0lkWXpBS0JnZ3Foa2lHOXcwQ0NqQWRCZ2xnaGtnQlpRTUVBU29FRUp1Wlpqb0oyZGJGdUpZN0ZNSisKN3g0RVFEcnRpZjNNb29rQk5PRTBUaGZmSEtrV0R3K3lvZ0ZRRk1RRFJtU0kwSXl2T2w4RTVnck5QcFNxU3dQNApIL2lzYzJvQVJzSW03alVRQXkrQjl5aTRZK3c9Ci0tLS0tRU5EIEVOQ1JZUFRFRCBQUklWQVRFIEtFWS0tLS0tCg==" + private_key_3 = crypto.import_private_key(bytearray(b64decode(private_key_3_bytes)), password="qwerty") + private_key_3_data = crypto.export_private_key(private_key_3) + self.assertEqual(VirgilKeyPair.privateKeyToDER(private_key_3_data), private_key_3_data) + + def test_public_key_is_der(self): + # STC-32 + crypto = VirgilCrypto() + key_pair_1 = crypto.generate_keys() + public_key_data_1 = crypto.export_public_key(key_pair_1.public_key) + self.assertEqual(VirgilKeyPair.publicKeyToDER(public_key_data_1), public_key_data_1) + + public_key_bytes = "LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUNvd0JRWURLMlZ3QXlFQXYycWRHa0w2RmRxc0xpLzdPQTA1NjJPOVYvVDhFN3F6RmF0RjZMcW9TY3M9Ci0tLS0tRU5EIFBVQkxJQyBLRVktLS0tLQo=" + public_key_2 = crypto.import_public_key(bytearray(b64decode(public_key_bytes))) + public_key_data_2 = crypto.export_public_key(public_key_2) + self.assertEqual(VirgilKeyPair.publicKeyToDER(public_key_data_2), public_key_data_2) + + def test_signature_hash(self): + # STC-30 + crypto = VirgilCrypto() + key_pair = crypto.generate_keys() + test_data = bytearray("test".encode()) + signature = crypto.sign(test_data, key_pair.private_key) + + self.assertEqual(bytearray(signature[0:17]), b64decode("MFEwDQYJYIZIAWUDBAIDBQA=")) diff --git a/virgil_crypto/tests/data/sdk_compatibility_data.json b/virgil_crypto/tests/data/sdk_compatibility_data.json index d7b05c6..d5c8e2d 100644 --- a/virgil_crypto/tests/data/sdk_compatibility_data.json +++ b/virgil_crypto/tests/data/sdk_compatibility_data.json @@ -1,59 +1,54 @@ { "encrypt_single_recipient": { - "private_key": "MC4CAQAwBQYDK2VwBCIEIBECILbNFMYhVXgeKhhaf8z5fVe71q7XxgKtC/JdDFnD", + "private_key": "MC4CAQAwBQYDK2VwBCIEIFx8vNiUAME3rwAoVMyuZg/F14FcMF5WETOeEV3Zr8c7", "original_data": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4=", - "cipher_data": "MIIBYgIBADCCAVsGCSqGSIb3DQEHA6CCAUwwggFIAgECMYIBGTCCARUCAQKgIgQgBr32MdKpF8fEeVggQuIOaa5+qQp7r5X4oA7SHpOsL14wBwYDK2VwBQAEgeIwgd8CAQAwKjAFBgMrZXADIQBsO1Gxkm9/1gACedbRzd/A88fwZsCP7I9Egrjo7H0MnDAYBgcogYxxAgUCMA0GCWCGSAFlAwQCAgUAMEEwDQYJYIZIAWUDBAICBQAEMJqCiMYLoWBQO56OQs89aOLIyqdt692crqG/cmvtkLeGMguLgyfX1O6BVAjbUHxT0jBRMB0GCWCGSAFlAwQBKgQQi+PBIt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DBAEqBBDvsCvGh4Md3BJrkbhjzwy7BDAbVyByTf2TeFeEqDywIfY/dQbQcMtmTD+2Bn/Y0HT1Z7ClAjrcKuxkB9W0Ys1L3FgwJgYJKoZIhvcNAQcBMBkGCWCGSAFlAwQBLgQMIe1v++T1huQVtzypcIEf22hv+SZqDTkIAjBWFv3ZouzgqZg9jHLYv6nA1IruM6OegDuBG4s/mm/PQ1bV8brJEZx5BwTuC/b03RhDs3j6LphSJ+8o" }, "sign_then_encrypt_single_recipient": { - "private_key": "MC4CAQAwBQYDK2VwBCIEIBf23ObmqCNbFYM/gAR//sQe3HFbis92oh7fDqkTRmzB", + "private_key": "MC4CAQAwBQYDK2VwBCIEIBjaHn6Z1QrXdAfRb034JoDhoXM+8hKYiQzQAg6+l419", "original_data": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4=", - "cipher_data": "MIIB1gIBADCCAVsGCSqGSIb3DQEHA6CCAUwwggFIAgECMYIBGTCCARUCAQKgIgQgCV3HaAx6fKGKzbTIvIqvGUiKNHW2M/O/jPXeKXqGiWEwBwYDK2VwBQAEgeIwgd8CAQAwKjAFBgMrZXADIQCVcrihRkcMEq9cUbU6KEVkTEufgHp2suLVC0oNGLF7hzAYBgcogYxxAgUCMA0GCWCGSAFlAwQCAgUAMEEwDQYJYIZIAWUDBAICBQAEMP2gJNowPLgQz4PRTU1oGOFl2RZ4cOP0txlJkcXtXXPK6l0llH13WMkum6pBPFVWQDBRMB0GCWCGSAFlAwQBKgQQGEgwPX0AMMZqOOj4YfVa9wQwcbrZR/rwmfRl6OctjRbHUzya8S0XQIVY8mrSY8693wfVtQd4x4w5a+J6IGbqn+OMMCYGCSqGSIb3DQEHATAZBglghkgBZQMEAS4EDBuOvdPwxNCa4P3hVaByMXAwbgwVVklSR0lMLURBVEEtU0lHTkFUVVJFolUEUzBRMA0GCWCGSAFlAwQCAgUABEDUi+0hXAjIrMyeKYISpZDhhMMeaggZi8Z3meW7ychcLEEJPCduTbVt3DZaXBc50xJLtdFyAMSqVC2/30RqfvcOS4SYjQS4sw3Vu7/d00tFAldI6maNBqYsi9xZy1yqDXOtzf4RI1R1pX8BI57b1FbiJx3rYMnq7UjKbu6BCVVnV99bW8nAyqWZ" + "cipher_data": "MIICFQIBADCCAVsGCSqGSIb3DQEHA6CCAUwwggFIAgECMYIBGTCCARUCAQKgIgQgQF9Aay6V4VGXDVrv1BknveFMztyCn1dt80nf7mqnj9IwBwYDK2VwBQAEgeIwgd8CAQAwKjAFBgMrZXADIQB0YhufvezF6W/834kAB7o5LPquTik/0qkMLRlmP7fEGjAYBgcogYxxAgUCMA0GCWCGSAFlAwQCAgUAMEEwDQYJYIZIAWUDBAICBQAEMID/2OZvTt0cClysYG6ZVlKfmEGEJLl12gLZ07qRo3qtm4ARwRoweHtedbzpdRefXjBRMB0GCWCGSAFlAwQBKgQQVdMd5xQjd2DE16rGrBTqIwQw4YxHOLiK8mvvH8cMIPsU0rpsM0fe+ohMnHCaW5ccTdgSMCOyVjaDUMqpl+KvIF4GMCYGCSqGSIb3DQEHATAZBglghkgBZQMEAS4EDCZnr2AeX892Duem8KCBsDGBrTA7DBVWSVJHSUwtREFUQS1TSUdORVItSUSiIgQgQF9Aay6V4VGXDVrv1BknveFMztyCn1dt80nf7mqnj9IwbgwVVklSR0lMLURBVEEtU0lHTkFUVVJFolUEUzBRMA0GCWCGSAFlAwQCAwUABEC9GjnFrMcTJ7YKj46bDyQQ/EEUzuePFOSPk8RKjrFDFCLfLkYH9gVdUCjGrVv07/FcuKEd9ZS86G4tUuh3F9gC7EEbYUtjCnPL31rWnAKeqi04gUq1wFLA1YdtOvAqjZUc1N3LQ+oiTo1ErCJKhRhugpApO2V3YLl/tsU3NbrqQv1rPwjA12G8" }, "sign_then_encrypt_multiple_recipients": { "private_keys": [ - "MC4CAQAwBQYDK2VwBCIEIGW3DU+4PHkk9LVv7zelcZn3Tl9aUdtq1glTbyC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EwLiD/qZUOMFEwHQYJYIZIAWUDBAEqBBDphHjyT3NaJV/Rq+r/x4cvBDDtY+WdlzXUsfEQvGp2fBwM8xI6sZRbk68gUuZpCjFICeVsD8pdiS4RrjjnPMY2h1MwJgYJKoZIhvcNAQcBMBkGCWCGSAFlAwQBLgQMtbmAUdn9qCGdQPOhoIGwMYGtMDsMFVZJUkdJTC1EQVRBLVNJR05FUi1JRKIiBCBn/kRbcLCg2q+2H8CEUz30RR6V6QQyUaLpvnzI7N3NQjBuDBVWSVJHSUwtREFUQS1TSUdOQVRVUkWiVQRTMFEwDQYJYIZIAWUDBAIDBQAEQKaB09lKLNo5mLRLxl4S5nI0dbYxwGUYUzXXtdLXnWMf4fxCPR0USW1qyIQLVUeJmtIhET3R/VPhqRrPKsFzyQAB/jziUKj409ykG++1OQg2FE5XhMhQoiFhTf8Cxo2tDeOOXCeQCy1SiG5wYJVXkVXFFNN8b59rJEp8RTRnIR8OfV6MkJsZCS4=" }, "generate_signature": { - "private_key": "MC4CAQAwBQYDK2VwBCIEIJRmL1aadPpXMV8uWhbJHjYf4sBSg/yoYyEXmUgnwynT", - "original_data": "U3VzcGVuZGlzc2UgZWxpdCBwdXJ1cywgbGFvcmVldCB1dCBuaWJoIG5lYy4=", - "signature": "MFEwDQYJYIZIAWUDBAICBQAEQBHqAlb/pf8lTdp+ina58O4XIY1pK7wOC6ZYFwbLbvpv1sme4nyBCAvrXvwYhSW66cP69Yt/1AUlvCsLbmURGgY=" - }, - "export_signable_request": { - "private_key": "MC4CAQAwBQYDK2VwBCIEIPMUTF+Tq2wgnG+kExeqPzrw3YWcVTrHYppBbFYE1kDR", - "exported_request": "eyJjb250ZW50X3NuYXBzaG90IjoiZXlKcFpHVnVkR2wwZVNJNkltRnNhV05sSWl3aWFXUmxiblJwZEhsZmRIbHdaU0k2SW0xbGJXSmxjaUlzSW5CMVlteHBZMTlyWlhraU9pSk5RMjkzUWxGWlJFc3lWbmRCZVVWQlRreHZaVGRDTUZReFkyVn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P45rU03arAogObdXGRD9bzEob7LzQNE8BWNF/JQY+pL0pC5Z3qH6tAc=" }, - "export_unpublished_local_virgil_card": { - "card_id": "23013680b496e30cfffa87aa2320a5f92049bd256182aeffae35e5459680983d", - "exported_card": "eyJpZCI6IjIzMDEzNjgwYjQ5NmUzMGNmZmZhODdhYTIzMjBhNWY5MjA0OWJkMjU2MTgyYWVmZmFlMzVlNTQ1OTY4MDk4M2QiLCJjb250ZW50X3NuYXBzaG90IjoiZXlKcFpHVnVkR2wwZVNJNkltRnNhV05sSWl3aWFXUmxiblJwZEhsZmRIbHdaU0k2SW5WdWEyNXZkMjRpTENKd2RXSnNhV05mYTJWNUlqb2lUVU52ZDBKUldVUkxNbFozUVhsRlFUUmpiVWd4S3pWbmFGZFJVRXBFUlVVMmVFcElZMlpCVkVOMGFYQm9ZekJqYm1kUGJIUm9TRnA0ZDBrOUlpd2ljMk52Y0dVaU9pSmhjSEJzYVdOaGRHbHZiaUlzSW1SaGRHRWlPbTUxYkd3c0ltbHVabThpT25zaVpHVjJhV05sSWpvaVYybHVNekpPVkNJc0ltUmxkbWxqWlY5dVlXMWxJam9pUkVWVFMxUlBVQzA1VUV4T1JFSXdJbjE5IiwibWV0YSI6eyJzaWducyI6eyIyMzAxMzY4MGI0OTZlMzBjZmZmYTg3YWEyMzIwYTVmOTIwNDliZDI1NjE4MmFlZmZhZTM1ZTU0NTk2ODA5ODNkIjoiTUZFd0RRWUpZSVpJQVdVREJBSUNCUUFFUUhYbHZDU1VXcDhCZWt0SUFIUGRnWFZTajMyV3A4RXBidFBqeDJVa2Z0WllzbzdIQUxCMzcyRnBxdk9hTlV1QURkREN3d2dOWkQrOVUybThNWVlsaVEwPSJ9LCJjcmVhdGVkX2F0IjoiMDAwMS0wMS0wMVQwMDowMDowMCIsImNhcmRfdmVyc2lvbiI6bnVsbH19" + "sign_then_encrypt_multiple_signers": { + "private_key": "MC4CAQAwBQYDK2VwBCIEIG6wyMA56aGMaKf8kaDqo7j/5onSM3SN6Do5q3P28Xzp", + "public_keys": [ + "MCowBQYDK2VwAyEALSCsIR2pEK5SWR8k1kOqCjkLM7SEoMS98vO4TJ6GMC4=", + "MCowBQYDK2VwAyEA2AsShcg1ZpK5PdUsDpcRKXjs1BMcNb6jHxZ5cD0jYC8=", + "MCowBQYDK2VwAyEA2EOIbFIMSDdd5PebefEH5bAdGqeyFWaBDyKntr8SG2k=", + "MCowBQYDK2VwAyEAZoH5Fn31VuT7xClvY3cLoNMkSQqeR8fPxAEUERFYdSQ=", + "MCowBQYDK2VwAyEAVBmCMI5YvsyCDQv5gyZhm+uWyHTnhILe/K9CNKUqkLw=" + ], + "original_data": "TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2NpbmcgZWxpdC4=", + "cipher_data": "MIIGeQIBADCCBb8GCSqGSIb3DQEHA6CCBbAwggWsAgECMYIFfTCCARUCAQKgIgQgV+lgOdbbR8aHUjIEx/YblRLUe/bGcH48E86p0I45JkMwBwYDK2VwBQAEgeIwgd8CAQAwKjAFBgMrZXADIQCAIRQh5ho70Jl3wuIpZxMv7bRzWgZDoBFtZafbiXCp2jAYBgcogYxxAgUCMA0GCWCGSAFlAwQCAgUAMEEwDQYJYIZIAWUDBAICBQAEMNPkFuMoCS/A9nzgZQ5lie5laQnGcfPYZVm6iwxual6USPOF6oqZd0EJu2xKx188IzBRMB0GCWCGSAFlAwQBKgQQd1cWGby4gwQgB8MTRmQxwgQweMtdoScv4IEQu0jwTXgasA3LvgUOiIAeSvUSdiYlh55Vx6sTe7cXjoheLKclSWgLMIIBFQIBAqAiBCB06AofjB8oEBQU0dRxXdJsbOSUq7Xscawaz29Akghv+DAHBgMrZXAFAASB4jCB3wIBADAqMAUGAytlcAMhAC8xBHqoj3SJ3lnrZRi4sKrLpAEv53VuyFeyyZr5parBMBgGByiBjHECBQIwDQYJYIZIAWUDBAICBQAwQTANBglghkgBZQMEAgIFAAQwd/+fkUJ92w1AxbBGE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wQTANBglghkgBZQMEAgIFAAQwM/lDhsv7B0Qq45Zi9pP7oKrlhzhtYlNk8Wh1uKA9mBWLqVQ61NlQVm9F2gk1gpPsMFEwHQYJYIZIAWUDBAEqBBDBBGvJ5lNVVw9/2/JU9ZHSBDA8y9XblGHB40qIniw+TeAt87peZP/mCYd4NCk91wt3perCNMhEJhoBq3KnB91Lyq4wJgYJKoZIhvcNAQcBMBkGCWCGSAFlAwQBLgQMXnmCLfBKuPnH+nxmoIGwMYGtMDsMFVZJUkdJTC1EQVRBLVNJR05FUi1JRKIiBCDPduTPhJEr+d0tx4DPkDWtzhClR1Cw4pKDwumD1h3b2zBuDBVWSVJHSUwtREFUQS1TSUdOQVRVUkWiVQRTMFEwDQYJYIZIAWUDBAIDBQAEQMbcL2CbQYHafMsmut9uyZ1c4cJGWk2cQZDZ8xcb/4EXeo/cJxFDhc59TVtjIImy8L4xpVLuI6+wGfwGIPmZKwlJubsUEUn+KHvHlS4z41YCsDrxXaDN8luv5jj+ERJg9MVrHttjMTOX0IIVoxcylbi6V2wd7/+KiL0JKx3dV5syJ4by+Y0y6eY=" } } From b2fa6fbc17889619d6cbc1e1b3b86d2302ccc37b Mon Sep 17 00:00:00 2001 From: Imelstorm Date: Tue, 22 Jan 2019 16:46:25 +0200 Subject: [PATCH 2/2] Optimize hash calculation usage --- virgil_crypto/crypto.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/virgil_crypto/crypto.py b/virgil_crypto/crypto.py index a01aa0e..6d3443b 100644 --- a/virgil_crypto/crypto.py +++ b/virgil_crypto/crypto.py @@ -401,12 +401,7 @@ def calculate_fingerprint(self, data): Returns: Fingerprint of the source data. """ - if self.use_sha256_fingerprints: - hash_algorithm = HashAlgorithm.SHA256 - hash_data = self.compute_hash(data, hash_algorithm) - else: - hash_algorithm = HashAlgorithm.SHA512 - hash_data = self.compute_hash(data, hash_algorithm)[0:8] + hash_data = self.__calculate_hash(data) return Fingerprint(hash_data) @@ -438,13 +433,8 @@ def compute_public_key_hash(self, public_key): Hash bytes. """ public_key_der = VirgilKeyPair.publicKeyToDER(public_key) - if self.use_sha256_fingerprints: - hash_algorithm = HashAlgorithm.SHA256 - computed_hash = self.compute_hash(public_key_der, hash_algorithm) - else: - hash_algorithm = HashAlgorithm.SHA512 - computed_hash = self.compute_hash(public_key_der, hash_algorithm)[0:8] - return computed_hash + hash_data = self.__calculate_hash(public_key_der) + return hash_data @property def custom_param_key_signature(self): @@ -458,3 +448,12 @@ def custom_param_key_signature(self): return self._CUSTOM_PARAM_KEY_SIGNATURE self._CUSTOM_PARAM_KEY_SIGNATURE = self.strtobytes("VIRGIL-DATA-SIGNATURE") return self._CUSTOM_PARAM_KEY_SIGNATURE + + def __calculate_hash(self, data): + if self.use_sha256_fingerprints: + hash_algorithm = HashAlgorithm.SHA256 + calculated_hash = self.compute_hash(data, hash_algorithm) + else: + hash_algorithm = HashAlgorithm.SHA512 + calculated_hash = self.compute_hash(data, hash_algorithm)[0:8] + return calculated_hash