File: cryptography_39-support.patch

package info (click to toggle)
python-pykmip 0.10.0-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,780 kB
  • sloc: python: 102,455; makefile: 33; sh: 12
file content (44 lines) | stat: -rw-r--r-- 1,856 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Description: Add cryptography >= 39.0.0 support
 The cryptography release 39.0.0 added a new parameter to the
 backend.load_pem_private_key and backend.load_der_private_key
 that's required. This patch uses the serialization method to load keys
 because there the new parameter is optional.
 .
 https://cryptography.io/en/latest/changelog/#v39-0-0
 .
 This patch fixes the tests test_encrypt_decrypt_asymmetric
Author: Daniel Garcia Moreno <daniel.garcia@suse.com>
Date: Thu, 26 Jan 2023 13:07:54 +0100
Origin: upstream, https://github.com/OpenKMIP/PyKMIP/commit/652d5cab.patch
Bug-Debian: https://bugs.debian.org/1067798
Last-Update: 2024-03-28

Index: python-pykmip/kmip/services/server/crypto/engine.py
===================================================================
--- python-pykmip.orig/kmip/services/server/crypto/engine.py
+++ python-pykmip/kmip/services/server/crypto/engine.py
@@ -935,18 +935,18 @@ class CryptographyEngine(api.Cryptograph
                     "decryption.".format(padding_method)
                 )
 
-            backend = default_backend()
-
             try:
-                private_key = backend.load_der_private_key(
+                private_key = serialization.load_der_private_key(
                     decryption_key,
-                    None
+                    password=None,
+                    backend=default_backend()
                 )
             except Exception:
                 try:
-                    private_key = backend.load_pem_private_key(
+                    private_key = serialization.load_pem_private_key(
                         decryption_key,
-                        None
+                        password=None,
+                        backend=default_backend()
                     )
                 except Exception:
                     raise exceptions.CryptographicFailure(