Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -74,6 +74,7 @@ def encrypt_text(data,in2,address):
|
|
74 |
def decrypt_text(im,in2):
|
75 |
enc_in = stegan2.decode(im)
|
76 |
private_key = RSA.import_key(open("private.pem").read())
|
|
|
77 |
enc_session_key = enc_in[:private_key.size_in_bytes()]
|
78 |
end1 = private_key.size_in_bytes()+16
|
79 |
nonce = enc_in[private_key.size_in_bytes():end1]
|
@@ -103,8 +104,8 @@ with gr.Blocks() as app:
|
|
103 |
with gr.Row():
|
104 |
gr.Column()
|
105 |
with gr.Column():
|
106 |
-
with gr.
|
107 |
-
with gr.
|
108 |
with gr.Column():
|
109 |
gen_wal_btn=gr.Button()
|
110 |
seed = gr.Textbox(label='Seed Phrase')
|
@@ -114,16 +115,20 @@ with gr.Blocks() as app:
|
|
114 |
out2 = gr.Textbox(label='Public Key')
|
115 |
img3=gr.Pil(label='Address')
|
116 |
out3 = gr.Textbox(label='Address')
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
|
|
121 |
rsa_dec_btn = gr.Button("RSA Decrypt")
|
122 |
rsa_dec_mes = gr.Textbox(label="decoded")
|
123 |
gr.Column()
|
124 |
|
125 |
gen_wal_btn.click(generate_keys,None,[out2,out1, img3,out3,img1,img2])
|
126 |
rsa_enc_btn.click(encrypt_text,[rsa_to_enc,out2,out3],[rsa_enc_mes,qr_enc_mes])
|
127 |
-
rsa_dec_btn.click(decrypt_text,[qr_enc_mes,
|
128 |
-
app.launch()
|
129 |
-
|
|
|
74 |
def decrypt_text(im,in2):
|
75 |
enc_in = stegan2.decode(im)
|
76 |
private_key = RSA.import_key(open("private.pem").read())
|
77 |
+
private_key = stegan2.decode(in2)
|
78 |
enc_session_key = enc_in[:private_key.size_in_bytes()]
|
79 |
end1 = private_key.size_in_bytes()+16
|
80 |
nonce = enc_in[private_key.size_in_bytes():end1]
|
|
|
104 |
with gr.Row():
|
105 |
gr.Column()
|
106 |
with gr.Column():
|
107 |
+
with gr.Tab("Gen Wal"):
|
108 |
+
with gr.Box():
|
109 |
with gr.Column():
|
110 |
gen_wal_btn=gr.Button()
|
111 |
seed = gr.Textbox(label='Seed Phrase')
|
|
|
115 |
out2 = gr.Textbox(label='Public Key')
|
116 |
img3=gr.Pil(label='Address')
|
117 |
out3 = gr.Textbox(label='Address')
|
118 |
+
rsa_to_enc = gr.Textbox(label="txt to encrypt")
|
119 |
+
rsa_enc_btn = gr.Button("RSA Encrypt")
|
120 |
+
rsa_enc_mes = gr.Textbox(label="encoded")
|
121 |
+
qr_enc_mes = gr.Image(type="filepath")
|
122 |
+
|
123 |
+
with gr.Tab("Decrypt"):
|
124 |
+
mes_in = gr.Pil("Message")
|
125 |
+
priv_key_in = gr.Pil("Private Key")
|
126 |
+
|
127 |
rsa_dec_btn = gr.Button("RSA Decrypt")
|
128 |
rsa_dec_mes = gr.Textbox(label="decoded")
|
129 |
gr.Column()
|
130 |
|
131 |
gen_wal_btn.click(generate_keys,None,[out2,out1, img3,out3,img1,img2])
|
132 |
rsa_enc_btn.click(encrypt_text,[rsa_to_enc,out2,out3],[rsa_enc_mes,qr_enc_mes])
|
133 |
+
rsa_dec_btn.click(decrypt_text,[qr_enc_mes,img1],rsa_dec_mes)
|
134 |
+
app.launch()
|
|