Im making a image encoder/decoder app with ASM.First i must write how it works:
1.I use wininet for READING a .JPG or .BMP or .ANYTHING from example.com/IMAGE.ANYTHING and store it inside variable cwhich work perfect but what i need and i failing since last week is use AES for encrypt that image and decrypt it from my FASM program ---example/IMG.BMP--*read bytes*--- then decrypt that bytes.Can someone help me With encoding and decoding ? Here is AES which work perfect with static string
format PE CONSOLE 4.0
entry start
include 'INCLUDE/win32a.inc'
include 'aes/aes.inc'
TEXTSIZE equ 3*BLOCK_SIZE
section '.text' code readable executable
start:
; stdcall encAES, TEXTSIZE, clear_msg, enc_msg, key128
; stdcall decAES, TEXTSIZE, enc_msg, dec_msg, key128
;stdcall encAES, TEXTSIZE, clear_msg, enc_msg, key192
;stdcall decAES, TEXTSIZE, enc_msg, dec_msg, key192
stdcall encAES, TEXTSIZE, clear_msg, enc_msg, key256
;stdcall decAES, TEXTSIZE, enc_msg, dec_msg, key256
push enc_msg
call [printf]
invoke getchar
invoke ExitProcess, 0
include 'aes/aes.asm'
section '.data' data readable writeable
clear_msg db 'hello world',\
0x0d, 0x0a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
enc_msg rb TEXTSIZE
dec_msg rb TEXTSIZE
key128 db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
key192 db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c,\
0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04
key256 db 0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c,\
0x03, 0x02, 0x01, 0x00, 0x07, 0x06, 0x05, 0x04,\
0x0b, 0x0a, 0x09, 0x08, 0x0f, 0x0e, 0x0d, 0x0c
section '.idata' import data readable writeable
library kernel,'KERNEL32.DLL',\
msvcrt,'MSVCRT'
import kernel,\
ExitProcess,'ExitProcess'
import msvcrt,\
printf,'printf',\
getchar,'_fgetchar'