Omkar008 commited on
Commit
699724f
1 Parent(s): 0867b22

Update get_gmail_data.py

Browse files
Files changed (1) hide show
  1. get_gmail_data.py +2 -1
get_gmail_data.py CHANGED
@@ -188,6 +188,7 @@ class GmailDataExtractor:
188
 
189
  def encrypt_message_id(self,message_id:str):
190
  key = os.getenv('AES_KEY')
 
191
 
192
  # Initialize AES cipher with the key and CBC mode
193
  cipher = Cipher(algorithms.AES(key), modes.CBC(), backend=default_backend())
@@ -197,7 +198,7 @@ class GmailDataExtractor:
197
 
198
  # Pad the message_id to be a multiple of 16 bytes (AES block size)
199
  # This is necessary for AES encryption
200
- message_id_padded = message_id.encode().rjust(32, b'\0')
201
 
202
  # Encrypt the padded message_id
203
  ciphertext = encryptor.update(message_id_padded) + encryptor.finalize()
 
188
 
189
  def encrypt_message_id(self,message_id:str):
190
  key = os.getenv('AES_KEY')
191
+ message_id_bytes = message_id.encode('utf-8')
192
 
193
  # Initialize AES cipher with the key and CBC mode
194
  cipher = Cipher(algorithms.AES(key), modes.CBC(), backend=default_backend())
 
198
 
199
  # Pad the message_id to be a multiple of 16 bytes (AES block size)
200
  # This is necessary for AES encryption
201
+ message_id_padded = message_id_bytes.encode().rjust(32, b'\0')
202
 
203
  # Encrypt the padded message_id
204
  ciphertext = encryptor.update(message_id_padded) + encryptor.finalize()