File: remove_http_ece

package info (click to toggle)
python-mastodon 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,076 kB
  • sloc: python: 2,573; makefile: 194; sql: 132
file content (70 lines) | stat: -rw-r--r-- 2,614 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Description: Remote http_ece dependency
 Method push_subscription_decrypt_push is removed as http_ece, which this
 and only this method depends on, is not available in Debian
Author: Craig Small <csmall@debian.org>
Forwarded: not-needed
Reviewed-by: Craig Small <csmall@debian.org>
Last-Update: 2019-02-05
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -17,14 +17,14 @@
 import re
 import copy
 import threading
-import sys
+#import sys
 import six
 from decorator import decorate
 from cryptography.hazmat.backends import default_backend
 from cryptography.hazmat.primitives.asymmetric import ec
-import http_ece
+#import http_ece
 import base64
-import json
+#import json
 
 try:
     from urllib.parse import urlparse
@@ -1888,22 +1888,26 @@
         
         Returns the decoded webpush as a `push notification dict`_.
         """
-        salt = self.__decode_webpush_b64(encryption_header.split("salt=")[1].strip())
-        dhparams = self.__decode_webpush_b64(crypto_key_header.split("dh=")[1].split(";")[0].strip())
-        p256ecdsa = self.__decode_webpush_b64(crypto_key_header.split("p256ecdsa=")[1].strip())
-        dec_key = ec.derive_private_key(decrypt_params['privkey'], ec.SECP256R1(), default_backend())
-        decrypted = http_ece.decrypt(
-            data,
-            salt = salt,
-            key = p256ecdsa,
-            private_key = dec_key, 
-            dh = dhparams, 
-            auth_secret=decrypt_params['auth'],
-            keylabel = "P-256",
-            version = "aesgcm"
-        )
-        
-        return json.loads(decrypted.decode('utf-8'), object_hook = Mastodon.__json_hooks)
+        """
+        Debian - remove this as http_ece is not in the distribution
+        """
+        raise(NotImplemented)
+#        salt = self.__decode_webpush_b64(encryption_header.split("salt=")[1].strip())
+#        dhparams = self.__decode_webpush_b64(crypto_key_header.split("dh=")[1].split(";")[0].strip())
+#        p256ecdsa = self.__decode_webpush_b64(crypto_key_header.split("p256ecdsa=")[1].strip())
+#        dec_key = ec.derive_private_key(decrypt_params['privkey'], ec.SECP256R1(), default_backend())
+#        decrypted = http_ece.decrypt(
+#            data,
+#            salt = salt,
+#            key = p256ecdsa,
+#            private_key = dec_key, 
+#            dh = dhparams, 
+#            auth_secret=decrypt_params['auth'],
+#            keylabel = "P-256",
+#            version = "aesgcm"
+#        )
+#        
+#        return json.loads(decrypted.decode('utf-8'), object_hook = Mastodon.__json_hooks)
     
     ###
     # Pagination