python4cpm 1.1.0__tar.gz → 1.1.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python4cpm
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Python for CPM
5
5
  Author-email: Gonzalo Atienza Rela <gonatienza@gmail.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "python4cpm"
7
- version = "1.1.0"
7
+ version = "1.1.1"
8
8
  description = "Python for CPM"
9
9
  authors = [
10
10
  { name = "Gonzalo Atienza Rela", email = "gonatienza@gmail.com" }
@@ -40,12 +40,12 @@ class Crypto:
40
40
  0,
41
41
  ctypes.byref(output_blob)
42
42
  )
43
- if crypt_res:
44
- plaintext = ctypes.string_at(output_blob.pbData, output_blob.cbData)
45
- ctypes.windll.kernel32.LocalFree(output_blob.pbData)
46
- return plaintext.decode("utf-16-le")
47
- else:
43
+ if not crypt_res:
48
44
  raise ctypes.WinError()
45
+ plaintext = ctypes.string_at(output_blob.pbData, output_blob.cbData)
46
+ ctypes.windll.kernel32.RtlZeroMemory(output_blob.pbData, output_blob.cbData)
47
+ ctypes.windll.kernel32.LocalFree(output_blob.pbData)
48
+ return plaintext.decode("utf-16-le")
49
49
 
50
50
  @classmethod
51
51
  def encrypt(cls, plaintext: str) -> str:
@@ -66,9 +66,9 @@ class Crypto:
66
66
  0,
67
67
  ctypes.byref(output_blob)
68
68
  )
69
- if crypt_res:
70
- encrypted = ctypes.string_at(output_blob.pbData, output_blob.cbData)
71
- ctypes.windll.kernel32.LocalFree(output_blob.pbData)
72
- return base64.b64encode(encrypted).decode()
73
- else:
69
+ if not crypt_res:
74
70
  raise ctypes.WinError()
71
+ ctypes.windll.kernel32.RtlZeroMemory(buffer, len(buffer))
72
+ encrypted = ctypes.string_at(output_blob.pbData, output_blob.cbData)
73
+ ctypes.windll.kernel32.LocalFree(output_blob.pbData)
74
+ return base64.b64encode(encrypted).decode()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python4cpm
3
- Version: 1.1.0
3
+ Version: 1.1.1
4
4
  Summary: Python for CPM
5
5
  Author-email: Gonzalo Atienza Rela <gonatienza@gmail.com>
6
6
  License-Expression: MIT
File without changes
File without changes
File without changes