spei-python 0.48.5__tar.gz → 0.48.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {spei_python-0.48.5 → spei_python-0.48.6}/PKG-INFO +1 -1
  2. {spei_python-0.48.5 → spei_python-0.48.6}/pyproject.toml +2 -2
  3. {spei_python-0.48.5 → spei_python-0.48.6}/spei/cep_generator.py +24 -16
  4. {spei_python-0.48.5 → spei_python-0.48.6}/README.md +0 -0
  5. {spei_python-0.48.5 → spei_python-0.48.6}/spei/README.md +0 -0
  6. {spei_python-0.48.5 → spei_python-0.48.6}/spei/__init__.py +0 -0
  7. {spei_python-0.48.5 → spei_python-0.48.6}/spei/checksum/__init__.py +0 -0
  8. {spei_python-0.48.5 → spei_python-0.48.6}/spei/checksum/factory.py +0 -0
  9. {spei_python-0.48.5 → spei_python-0.48.6}/spei/checksum/generator.py +0 -0
  10. {spei_python-0.48.5 → spei_python-0.48.6}/spei/checksum/types.py +0 -0
  11. {spei_python-0.48.5 → spei_python-0.48.6}/spei/client.py +0 -0
  12. {spei_python-0.48.5 → spei_python-0.48.6}/spei/errors/__init__.py +0 -0
  13. {spei_python-0.48.5 → spei_python-0.48.6}/spei/errors/sice.py +0 -0
  14. {spei_python-0.48.5 → spei_python-0.48.6}/spei/errors/spei.py +0 -0
  15. {spei_python-0.48.5 → spei_python-0.48.6}/spei/exceptions.py +0 -0
  16. {spei_python-0.48.5 → spei_python-0.48.6}/spei/mappings.py +0 -0
  17. {spei_python-0.48.5 → spei_python-0.48.6}/spei/requests/__init__.py +0 -0
  18. {spei_python-0.48.5 → spei_python-0.48.6}/spei/requests/acuse.py +0 -0
  19. {spei_python-0.48.5 → spei_python-0.48.6}/spei/requests/cda.py +0 -0
  20. {spei_python-0.48.5 → spei_python-0.48.6}/spei/requests/orden.py +0 -0
  21. {spei_python-0.48.5 → spei_python-0.48.6}/spei/requests/respuesta.py +0 -0
  22. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/__init__.py +0 -0
  23. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/acuse.py +0 -0
  24. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/cda.py +0 -0
  25. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/ensesion.py +0 -0
  26. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/mensaje.py +0 -0
  27. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/orden.py +0 -0
  28. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/payments.py +0 -0
  29. {spei_python-0.48.5 → spei_python-0.48.6}/spei/resources/respuesta.py +0 -0
  30. {spei_python-0.48.5 → spei_python-0.48.6}/spei/responses/__init__.py +0 -0
  31. {spei_python-0.48.5 → spei_python-0.48.6}/spei/responses/acuse.py +0 -0
  32. {spei_python-0.48.5 → spei_python-0.48.6}/spei/responses/orden.py +0 -0
  33. {spei_python-0.48.5 → spei_python-0.48.6}/spei/responses/respuesta.py +0 -0
  34. {spei_python-0.48.5 → spei_python-0.48.6}/spei/sice.py +0 -0
  35. {spei_python-0.48.5 → spei_python-0.48.6}/spei/types/__init__.py +0 -0
  36. {spei_python-0.48.5 → spei_python-0.48.6}/spei/types/sice.py +0 -0
  37. {spei_python-0.48.5 → spei_python-0.48.6}/spei/types/spei.py +0 -0
  38. {spei_python-0.48.5 → spei_python-0.48.6}/spei/utils.py +0 -0
  39. {spei_python-0.48.5 → spei_python-0.48.6}/spei/validators.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: spei-python
3
- Version: 0.48.5
3
+ Version: 0.48.6
4
4
  Summary:
5
5
  Author: tech
6
6
  Author-email: tech@fondeadora.com
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "spei-python"
3
- version = "0.48.5"
3
+ version = "0.48.6"
4
4
  description = ""
5
5
  authors = ["tech <tech@fondeadora.com>"]
6
6
  readme = "README.md"
@@ -32,7 +32,7 @@ build-backend = "poetry.core.masonry.api"
32
32
 
33
33
  [tool.commitizen]
34
34
  name = "cz_conventional_commits"
35
- version = "0.48.5"
35
+ version = "0.48.6"
36
36
  tag_format = "v$version"
37
37
  bump_message = "bump: Semantic Release Bot: Release Version: $new_version 🤖🚀 [skip ci]"
38
38
  version_files = [
@@ -44,37 +44,45 @@ class CepGenerator(object):
44
44
  return self._encrypt_string(string)
45
45
 
46
46
  def decrypt_string(self, encrypted_data_base64: str) -> str: # noqa: WPS210
47
- backend = default_backend()
48
47
  encrypted_data = base64.b64decode(encrypted_data_base64)
49
48
  iv = encrypted_data[:IV_LIMIT]
50
- cipher = Cipher(
51
- algorithms.AES(base64.b64decode(self.key_base64)),
52
- modes.CBC(iv),
53
- backend=backend,
49
+ decryptor = self.decryptor(iv)
50
+
51
+ decrypted_data = (
52
+ decryptor.update(
53
+ encrypted_data[IV_LIMIT:],
54
+ )
55
+ + decryptor.finalize()
54
56
  )
55
- decryptor = cipher.decryptor()
56
- decrypted_data = decryptor.update(
57
- encrypted_data[IV_LIMIT:],
58
- ) + decryptor.finalize()
57
+
59
58
  unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
60
59
  unpadded_data = unpadder.update(decrypted_data) + unpadder.finalize()
61
60
 
62
61
  return unpadded_data.decode()
63
62
 
63
+ def encryptor(self, iv: bytes, backend=None):
64
+ return self.cipher(iv, backend=backend).encryptor()
65
+
66
+ def decryptor(self, iv: bytes, backend=None):
67
+ return self.cipher(iv, backend=backend).decryptor()
68
+
69
+ def cipher(self, iv: bytes, backend=None):
70
+ return Cipher(
71
+ algorithms.AES(base64.b64decode(self.key_base64)),
72
+ modes.CBC(iv),
73
+ backend=backend or default_backend(),
74
+ )
75
+
64
76
  def _format_date(self, date: datetime.datetime) -> str:
65
77
  return date.strftime('%Y%m%d')
66
78
 
67
79
  def _encrypt_string(self, string: str) -> str: # noqa: WPS210
68
- backend = default_backend()
69
80
  iv = self.rng(IV_LIMIT)
70
- cipher = Cipher(
71
- algorithms.AES(base64.b64decode(self.key_base64)),
72
- modes.CBC(iv),
73
- backend=backend,
74
- )
75
- encryptor = cipher.encryptor()
81
+ encryptor = self.encryptor(iv)
82
+
76
83
  padder = padding.PKCS7(algorithms.AES.block_size).padder()
77
84
  padded_data = padder.update(string.encode()) + padder.finalize()
85
+
78
86
  encrypted_data = encryptor.update(padded_data) + encryptor.finalize()
79
87
  encrypted_data_base64 = base64.b64encode(iv + encrypted_data)
80
88
 
File without changes
File without changes
File without changes