aes

Python AES encryption shows different result from originating C# code

Python AES encryption shows different result from originating C# code Question: The below code is my C# code for encryption using System; using System.IO; using System.Text; using System.Security.Cryptography; public static string Encrypt(string value) { byte[] bytes = Encoding.Unicode.GetBytes(value); Aes aes = Aes.Create(); Rfc2898DeriveBytes rfc2898DeriveBytes = new Rfc2898DeriveBytes("aaaabbbbccccddddffffeeee", new byte[13] { 73, 118, 97, 110, 32, …

Total answers: 1

Python Aes-256 GMC decrypt error at decode result

Python Aes-256 GMC decrypt error at decode result Question: I’m facing a issue to decrypt data that was encrypted in Node JS into python code: Error at "return decrypted.decode(‘utf-8’)" Error: ‘utf-8’ codec can’t decode byte 0xc8 in position 0: invalid continuation byte any idea why? import base64 from Crypto.Cipher import AES args = { "content": …

Total answers: 1

loss of data when decrypting a file in Python server from CPP client

loss of data when decrypting a file in Python server from CPP client Question: I am trying to send a file from a client written in CPP to a server written in Python. I am using AES encryption on client side to encrypt the file and then send it to the server, the AES key …

Total answers: 2

AssertionError – Creating my own python library and I am getting an assertion error

AssertionError – Creating my own python library and I am getting an assertion error Question: I am coding an encryption library that allows you generate either symmetric or asymmetric key/key pair and use it within Either of these 4 classes: TextEncA, TextEncS, ImageEncA and ImageEncS. The code looks to be syntactically correct however while testing …

Total answers: 1

Python Incorrect AES key length despite passing the a 32 bytes bytearray

Python Incorrect AES key length despite passing the a 32 bytes bytearray Question: I have a specific AES key that I have to work with which is 11h,FFh,E4h,"I",BCh,D4h,96h,"SRZ",BEh,B2h,BEh,D0h,89h,E6h,EBh,91h,92h,"f",FCh,"#",BBh,F8h,"hn",8Dh,"Y",19h,"g",8Ah,"Q" I have to use this key to encrypt a message. In python I covert it to "x11,xFF,xE4,I,xBC,xD4,x96,SRZ,xBE,xB2,xBE,xD0,x89,xE6,xEB,x91,x92,f,xFC,#,xBB,xF8,hn,x8D,Y,x19,g,x8A,Q" but I get ValueError: Incorrect AES key length (60 bytes). …

Total answers: 1

AES-GCM 256-bit VS. SSL/TLS for socket security

AES-GCM 256-bit VS. SSL/TLS for socket security Question: Is there a difference between using AES-GCM 256-bit encryption, or using SSL/TLS to pass data over a socket. I am currently passing data back and forth from client to server, using asymmetric AES-GCM 256-bit encryption. Is there an advantage to using SSL/TLS as opposed to my current …

Total answers: 1

AES key (string) input, unable to be converted to corresponding byte sequences correctly

AES key (string) input, unable to be converted to corresponding byte sequences correctly Question: My python program takes a AES key as input. For example, xee~xb0x94Lhx9fnr?x18xdfxa4_7Ixf7xd8T?x13xd0xbd4x8eQx9bx89xa4cxf9xf1 This string input must now be converted back to a byte sequences, so that the key can be used in decryption. aes_key = str.encode(user_input) # user_input being the key …

Total answers: 1

How to do a Circular left shift for a byte in python

How to do a Circular left shift for a byte in python Question: I am trying to do a left-byte shift on a list. But it is not working properly. def left_byte_shift(w3): temp = w3 x=0 a = (len(w3)-1) print("a=",a) for i in reversed(range(len(w3))): if i == a: #3 w3[x] = temp[a] else: #2,1,0 print(w3[i],temp[i+1]) …

Total answers: 2

Why I cant decode AES-CTR in python

Why I cant decode AES-CTR in python Question: Im reversing a site to write an api for it, and there is an AES encryption. I figured out that this is AES CTR mode and that 8 byte nonce is prefix for ciphertext. However, when I try decoding with PyCrypto I get nonsence results. This is …

Total answers: 1