File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change 6
6
import typing
7
7
from base64 import b64encode
8
8
from hashlib import sha1
9
- from typing import Dict
9
+ from typing import Dict , List
10
10
11
11
from Cryptodome import Cipher
12
12
from Cryptodome import Random
@@ -112,6 +112,16 @@ def _should_sign_request_header(header_name: str) -> bool:
112
112
return False
113
113
114
114
115
+ def generate_signature (string_to_sign : str , key_pair : RsaKey ) -> str :
116
+ bytes_to_sign = string_to_sign .encode ()
117
+ signer = PKCS1_v1_5 .new (key_pair )
118
+ digest = SHA256 .new ()
119
+ digest .update (bytes_to_sign )
120
+ sign = signer .sign (digest )
121
+
122
+ return b64encode (sign )
123
+
124
+
115
125
def encrypt (api_context : ApiContext ,
116
126
request_bytes : bytes ,
117
127
custom_headers : Dict [str , str ]) -> bytes :
@@ -210,3 +220,7 @@ def _should_sign_response_header(header_name: str) -> bool:
210
220
return True
211
221
212
222
return False
223
+
224
+
225
+ def get_certificate_chain_string (all_chain_certificate : List [str ]):
226
+ return _DELIMITER_NEWLINE .join (all_chain_certificate )
You can’t perform that action at this time.
0 commit comments