Second version of encrypt
This commit is contained in:
parent
21679ebb92
commit
c844449871
@ -14,7 +14,7 @@ import threading
|
|||||||
|
|
||||||
from Crypto.Cipher import PKCS1_OAEP
|
from Crypto.Cipher import PKCS1_OAEP
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
|
from Crypto.Cipher import PKCS1_OAEP
|
||||||
|
|
||||||
class Decoder(json.JSONDecoder):
|
class Decoder(json.JSONDecoder):
|
||||||
def decode(self, s, **kwargs):
|
def decode(self, s, **kwargs):
|
||||||
@ -101,21 +101,20 @@ print('ok')
|
|||||||
chunk = clientSocket.recv(BUFFER_SIZE)
|
chunk = clientSocket.recv(BUFFER_SIZE)
|
||||||
print(chunk)
|
print(chunk)
|
||||||
# HEADER
|
# HEADER
|
||||||
cry_header = clientSocket.recv(BUFFER_SIZE).rstrip(b';')
|
crypted = clientSocket.recv(BUFFER_SIZE).rstrip(b';')
|
||||||
print(cry_header)
|
|
||||||
# AESKEY
|
# AESKEY
|
||||||
cry_aeskey = clientSocket.recv(BUFFER_SIZE).rstrip(b";")
|
for i in range(60):
|
||||||
print(cry_aeskey)
|
crypted += clientSocket.recv(BUFFER_SIZE).rstrip(b";")
|
||||||
# END
|
# END
|
||||||
chunk = clientSocket.recv(BUFFER_SIZE)
|
chunk = clientSocket.recv(BUFFER_SIZE)
|
||||||
print(chunk)
|
print(chunk)
|
||||||
|
|
||||||
# HEADER+AES key are encypted in same time, so decrypt thme at same time
|
# HEADER+AES key are encypted in same time, so decrypt thme at same time
|
||||||
cipher_rsa = PKCS1_OAEP.new(key)
|
cipher_rsa = PKCS1_OAEP.new(key)
|
||||||
t = cry_header+cry_aeskey
|
texte = b''
|
||||||
for to_decrypt in [t[i:i + int(len(public_key)/16)] for i in range(0, len(t), int(len(public_key)/16))]:
|
for to_decrypt in [crypted[i:i + int(BUFFER_SIZE/8)] for i in range(0, len(crypted), int(BUFFER_SIZE/8))]:
|
||||||
print(len(to_decrypt))
|
texte += cipher_rsa.decrypt(to_decrypt)
|
||||||
print(cipher_rsa.decrypt(to_decrypt))
|
print(texte.decode('ascii'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,51 +1,51 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
MIIJKAIBAAKCAgEAvlMf7Wn+JRaFR4ErqgpQA3m86J++XPRZrKK6UJtdUqGI3Xug
|
MIIJKQIBAAKCAgEArUCxN8128/Zck+vS0xtRwvQFhsl44wV8I5987RNdU/sYFkoG
|
||||||
iqbYUSr2n5+LOlfPNDQ6okcqGX+uJFaetWiiJLqzYvl+UjXwDK/jvCwlHvnjmViU
|
CkMLFiXXhrcsYhzEEyKQ6ci+4OtwPtXuY9hE8XWnmd16T6ypct41oRoCVzrlrwMs
|
||||||
w0MDzKyVfiNfwWAsoQXuQqk+vJWwyFuskxXIQDRlHoye6KGsciweDcJjqqwurw5E
|
Z1rg4M5ZnuQIb+7DJmIDHn3LjYF1yDC1XhoG1DZn+tWK1XPyCpWzjYHyUyocWiHK
|
||||||
brozOeuC8pkl4gxK8xQcc6sYxc8Rs5EjYug5qRbNw8FHiM6AIovYlrew2pzAyUDT
|
0lxxE3lLYj2okaWYjuwv+stt7ClpqPMjog2eg51H99rxKEEhlt+lDYXPEfWaPB4l
|
||||||
PkOmmDZzESlmLWhTeS0GEaewvv+WX2yzE3yFe9tSAO8SlBGaJ3LNpGIwDKgLH+9k
|
WjlrophFqvndnYtZMJJfHwDyysQSvcwGL01KwKYR+URM5Lr8Zxj9xBP1v5NsxBTE
|
||||||
FbQPkcLB0AnGnTAVvS/6nALWVYkXv98JacXVGXBkWobn3IvWZ1djUXMpgs4haJfp
|
1imZQ/cF7Nat4A/RCycHB4CrgtgtwlcHPJQWF4WxJN6+THM698oNQ8jKAwIuMPHR
|
||||||
Cx5+KoRwkdBjQzPC/Ztx94lE9wd+3nNfusJVIzZVcdfysbojbcNLnp77NYBFaAxw
|
8XH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BPgYeiOu3jtx4+NyAV/r1z7di/Y8A
|
+HyV0fGDIAz2K7Oij8ZBuoG6WNf/JmFifEsBndxIya+XMququ0cE/43premlG7+B
|
||||||
HuxjotGMZEccqHL411qiC9fv3kw8iD3gO0qgrx5sXygt/zuKXllQEjS6ShRXBH1e
|
6Xo2Lauw8LIFx+2HAGj9pFtwVkjdL3kj11lg6qHfIWTGHdHP8Sgv+Y5+SInTcY+U
|
||||||
1kCXstGWvoK1ZMPa3RAPlxd0kSD1OXmdAGBsVw875h50+veax7iAjwZpBzSo4Tol
|
IU0YC1O/NDDXVZpVBCFPhpRNejw+u6aZfXWEY9WRxXnLrpj665/jkMArG7idYgjX
|
||||||
kGJL6ccxysxcllnmlJnjC/c6HjPsFI5T3QAnXn21zvwvbmuQAtYKhASgmfE=
|
w4hMBTVZUhhfgZjMOP7a+I8bB7ySSVl0TGoDLDyPptWnnMv9jqWLlAb7WN5F
|
||||||
-----END RSA PRIVATE KEY-----
|
-----END RSA PRIVATE KEY-----
|
@ -1,14 +1,14 @@
|
|||||||
-----BEGIN PUBLIC KEY-----
|
-----BEGIN PUBLIC KEY-----
|
||||||
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAvlMf7Wn+JRaFR4ErqgpQ
|
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEArUCxN8128/Zck+vS0xtR
|
||||||
A3m86J++XPRZrKK6UJtdUqGI3XugiqbYUSr2n5+LOlfPNDQ6okcqGX+uJFaetWii
|
wvQFhsl44wV8I5987RNdU/sYFkoGCkMLFiXXhrcsYhzEEyKQ6ci+4OtwPtXuY9hE
|
||||||
JLqzYvl+UjXwDK/jvCwlHvnjmViUw0MDzKyVfiNfwWAsoQXuQqk+vJWwyFuskxXI
|
8XWnmd16T6ypct41oRoCVzrlrwMsZ1rg4M5ZnuQIb+7DJmIDHn3LjYF1yDC1XhoG
|
||||||
QDRlHoye6KGsciweDcJjqqwurw5EbrozOeuC8pkl4gx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L/ZhhfqNWwSWdIkCAwEAAQ==
|
z0AzpZR3VID1JVgUhpqsA1UCAwEAAQ==
|
||||||
-----END PUBLIC KEY-----
|
-----END PUBLIC KEY-----
|
@ -151,7 +151,7 @@ class clientThread(threading.Thread):
|
|||||||
debug("Réception de la clef RSA de %s", self.ip)
|
debug("Réception de la clef RSA de %s", self.ip)
|
||||||
self.rsa_client = content.rstrip(b";").rstrip(b' ')
|
self.rsa_client = content.rstrip(b";").rstrip(b' ')
|
||||||
self.aes_key = get_random_bytes(64)
|
self.aes_key = get_random_bytes(64)
|
||||||
header = bytes((VERSION+"\ntype: init").ljust(BUFFER_SIZE, "-"), 'ascii')
|
header = bytes((VERSION+"\ntype: init").ljust(BUFFER_SIZE, ";"), 'ascii')
|
||||||
content = self.aes_key.ljust(BUFFER_SIZE, b";")
|
content = self.aes_key.ljust(BUFFER_SIZE, b";")
|
||||||
self.send_rsa(header+content)
|
self.send_rsa(header+content)
|
||||||
return
|
return
|
||||||
@ -166,19 +166,18 @@ class clientThread(threading.Thread):
|
|||||||
# RSA crypter object
|
# RSA crypter object
|
||||||
cipher_rsa = PKCS1_OAEP.new(recipient_key)
|
cipher_rsa = PKCS1_OAEP.new(recipient_key)
|
||||||
# Encrypt session_key
|
# Encrypt session_key
|
||||||
self.client.send(BEGIN_MESSAGE)
|
crypted = b""
|
||||||
for to_send_text in [to_send[i:i + BUFFER_SIZE] for i in range(0, len(to_send), BUFFER_SIZE)]:
|
for to_send_text in [to_send[i:i + 16] for i in range(0, len(to_send), 16)]:
|
||||||
crypted = b""
|
crypted += cipher_rsa.encrypt(to_send_text)
|
||||||
for to_send_text_ in [to_send_text[i:i+int(len(self.rsa_client)/16)] for i in range(0, len(to_send_text), int(len(self.rsa_client)/16))]:
|
self.send(crypted)
|
||||||
print(len(to_send_text_))
|
|
||||||
crypted += cipher_rsa.encrypt(to_send_text_)
|
|
||||||
self.client.send(crypted.ljust(BUFFER_SIZE, b';'))
|
|
||||||
self.client.send(END_MESSAGE)
|
|
||||||
|
|
||||||
def send(self, to_send):
|
def send(self, to_send):
|
||||||
self.client.send(BEGIN_MESSAGE)
|
self.client.send(BEGIN_MESSAGE)
|
||||||
|
i=0
|
||||||
for to_send_text in [to_send[i:i + BUFFER_SIZE] for i in range(0, len(to_send), BUFFER_SIZE)]:
|
for to_send_text in [to_send[i:i + BUFFER_SIZE] for i in range(0, len(to_send), BUFFER_SIZE)]:
|
||||||
self.client.send(to_send_text.ljust(BUFFER_SIZE, b";"))
|
self.client.send(to_send_text.ljust(BUFFER_SIZE, b";"))
|
||||||
|
i+=1
|
||||||
|
print(i)
|
||||||
self.client.send(END_MESSAGE)
|
self.client.send(END_MESSAGE)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user