Omnibus commited on
Commit
42dc7db
·
1 Parent(s): bab441f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -171,22 +171,20 @@ def decrypt_text1(im,in2):
171
  #with open("encrypted_data1.bin", "wb") as file:
172
  # file.write(enc_in)
173
  #file.close()
174
-
175
  file_in = open("encrypted_data.bin", "rb")
176
 
177
  private_key = RSA.import_key(open("private.pem").read())
 
178
  #enc_in=enc_in.strip('"')
179
  #enc_session_key, nonce, tag, cipher_text = enc_in[0],enc_in[1],enc_in[2],enc_in[3]
180
  enc_session_key, nonce, tag, ciphertext = \
181
- [ base64.b64decode(file_in.read(x)) for x in (private_key.size_in_bytes(), 16, 16, -1) ]
182
  file_in.close()
183
  print (f'enc_session_key::{enc_session_key}')
184
  print (f'nonce::{nonce}')
185
  print (f'tag::{tag}')
186
  print (f'ciphertext::{ciphertext}')
187
-
188
-
189
-
190
 
191
  # Decrypt the session key with the private RSA key
192
  cipher_rsa = PKCS1_OAEP.new(private_key)
 
171
  #with open("encrypted_data1.bin", "wb") as file:
172
  # file.write(enc_in)
173
  #file.close()
174
+
175
  file_in = open("encrypted_data.bin", "rb")
176
 
177
  private_key = RSA.import_key(open("private.pem").read())
178
+
179
  #enc_in=enc_in.strip('"')
180
  #enc_session_key, nonce, tag, cipher_text = enc_in[0],enc_in[1],enc_in[2],enc_in[3]
181
  enc_session_key, nonce, tag, ciphertext = \
182
+ [ file_in.read(x) for x in (private_key.size_in_bytes(), 16, 16, -1) ]
183
  file_in.close()
184
  print (f'enc_session_key::{enc_session_key}')
185
  print (f'nonce::{nonce}')
186
  print (f'tag::{tag}')
187
  print (f'ciphertext::{ciphertext}')
 
 
 
188
 
189
  # Decrypt the session key with the private RSA key
190
  cipher_rsa = PKCS1_OAEP.new(private_key)