Function at 0x40aac0
Capabilities:
Encrypt or decrypt via wincrypt

Disassembly:
push ebp
xor ecx, ecx
mov eax, 0x6601
mov ebp, esp
push edi
push esi
lea edx, [ebp - 0x48]
push ebx
sub esp, 0x78
call fcn.00407220
test eax, eax
je 0x40b5a0
lea eax, [ebp - 0x40]
mov dword [ebp - 0x40], 2
mov edi, dword [sym.imp.advapi32.dll_CryptSetKeyParam]
mov dword [esp + 0xc], 0
mov dword [esp + 8], eax
mov dword [esp + 4], 4
mov eax, dword [ebp - 0x48]
mov esi, dword fs:[0x18]
mov dword [esp], eax
call edi
sub esp, 0x10
mov ebx, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3a8
mov eax, dword [esi + 0x34]
mov dword [esp], ebx
mov dword [esp + 8], eax
mov dword [esp + 4], str._08lx_n
call fcn.00401ac0
lea eax, [ebp - 0x44]
mov dword [ebp - 0x44], 4
mov dword [esp + 0xc], eax
lea eax, [ebp - 0x40]
mov dword [esp + 0x10], 0
mov dword [esp + 8], eax
mov dword [esp + 4], 4
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
call dword [sym.imp.advapi32.dll_CryptGetKeyParam]
sub esp, 0x14
mov ebx, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3ac
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp + 8], eax
mov dword [esp], ebx
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3ad
mov eax, dword [ebp - 0x40]
mov dword [esp + 4], str.Expected_CRYPT_MODE_ECB__got__ld_n
cmp eax, 2
mov dword [esp + 8], eax
sete al
movzx eax, al
mov dword [esp], eax
call fcn.00401ac0
xor eax, eax
lea esi, [esi]
mov byte [ebp + eax - 0x3c], al
add eax, 1
cmp eax, 0x10
jne 0x40abd8
lea eax, [ebp - 0x44]
mov dword [ebp - 0x44], 0xd
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0x18], 0x10
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
mov eax, dword [sym.imp.advapi32.dll_CryptEncrypt]
mov dword [ebp - 0x64], eax
call eax
sub esp, 0x1c
mov ebx, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3b3
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp], ebx
mov dword [esp + 8], eax
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3b5
cmp dword [ebp - 0x3c], 0x46428658
je 0x40b568
mov eax, 1
xor eax, 1
mov dword [esp + 4], str.DES_encryption_failed__n
mov esi, 0x4190c0
mov dword [esp], eax
call fcn.00401ac0
lea eax, [ebp - 0x44]
mov dword [esp + 0xc], 0
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0x10], eax
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
mov eax, dword [sym.imp.advapi32.dll_CryptDecrypt]
mov dword [ebp - 0x54], eax
call eax
sub esp, 0x18
mov ebx, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3b8
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp], ebx
mov dword [esp + 8], eax
call fcn.00401ac0
mov dword [ebp - 0x4c], 0
mov dword [ebp - 0x68], edi
mov edx, dword [esi + 0x20]
lea eax, [esi - 0x20]
mov dword [ebp - 0x58], edx
mov dword [esp + 4], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 8], edx
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov edi, dword [esi + 0x24]
mov ebx, dword [esi + 0x28]
lea eax, [ebp - 0x44]
mov dword [ebp - 0x50], edi
mov dword [ebp - 0x44], edi
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0x18], ebx
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
mov eax, dword [ebp - 0x64]
call eax
sub esp, 0x1c
mov edi, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov ecx, dword fs:[0x18]
mov dword [eax + 4], 0x3c0
mov eax, dword [ecx + 0x34]
mov dword [ebp - 0x5c], ecx
mov dword [esp + 8], eax
mov dword [esp], edi
mov dword [esp + 4], str._08lx_n
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3c1
mov eax, dword [ebp - 0x44]
mov dword [esp + 0xc], ebx
cmp eax, ebx
mov dword [esp + 8], eax
sete al
mov dword [esp + 4], str.length_incorrect__got__ld__expected__d_n
movzx eax, al
mov dword [esp], eax
call fcn.00401ac0
lea eax, [ebp - 0x3c]
mov dword [esp + 8], ebx
mov dword [esp + 4], eax
lea eax, [ebp - 0x2c]
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
lea eax, [ebp - 0x44]
mov dword [esp + 0xc], 0
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0x10], eax
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
mov eax, dword [ebp - 0x54]
call eax
sub esp, 0x18
mov edi, eax
call fcn.00412e10
mov ecx, dword [ebp - 0x5c]
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3c5
mov eax, dword [ecx + 0x34]
mov dword [esp], edi
mov dword [esp + 8], eax
mov dword [esp + 4], str._08lx_n
call fcn.00401ac0
call fcn.00412e10
mov edi, dword [ebp - 0x50]
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3c6
mov eax, dword [ebp - 0x44]
mov dword [esp + 0xc], edi
cmp eax, edi
mov dword [esp + 8], eax
sete al
mov dword [esp + 4], str.length_incorrect__got__ld__expected__d_n
movzx eax, al
mov dword [esp], eax
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3c7
lea eax, [ebp - 0x3c]
mov dword [esp + 8], edi
mov dword [esp + 4], esi
mov dword [esp], eax
call sub.msvcrt.dll_memcmp
mov ecx, dword [ebp - 0x4c]
mov dword [esp + 4], str.decryption_incorrect__d_n
test eax, eax
sete al
mov dword [esp + 8], ecx
movzx eax, al
mov dword [esp], eax
call fcn.00401ac0
cmp edi, dword [ebp - 0x44]
jne 0x40aeeb
lea eax, [ebp - 0x3c]
mov dword [esp + 8], edi
mov dword [esp + 4], esi
mov dword [esp], eax
call sub.msvcrt.dll_memcmp
test eax, eax
je 0x40afa3
mov dword [esp + 4], str.expected
mov dword [esp], 0x416079
call dword [sym.imp.msvcrt.dll_printf]
mov eax, dword [ebp - 0x58]
lea ecx, [eax + esi]
test eax, eax
je 0x40af36
mov dword [ebp - 0x5c], ebx
mov edi, ecx
mov ebx, esi
lea esi, [esi]
movzx eax, byte [ebx]
add ebx, 1
mov dword [esp], str.0x_02x_
mov dword [esp + 4], eax
call dword [sym.imp.msvcrt.dll_printf]
cmp edi, ebx
jne 0x40af18
mov ebx, dword [ebp - 0x5c]
mov dword [esp], 0xa
lea edi, [ebp - 0x3c]
call dword [sym.imp.msvcrt.dll_putchar]
mov ecx, dword [ebp - 0x44]
mov dword [ebp - 0x5c], ecx
mov dword [esp + 4], 0x417722
mov dword [esp], 0x416079
call dword [sym.imp.msvcrt.dll_printf]
mov ecx, dword [ebp - 0x5c]
mov eax, edi
add eax, ecx
test ecx, ecx
je 0x40af96
mov dword [ebp - 0x5c], ebx
mov ebx, edi
mov edi, eax
lea esi, [esi]
nop
movzx eax, byte [ebx]
add ebx, 1
mov dword [esp], str.0x_02x_
mov dword [esp + 4], eax
call dword [sym.imp.msvcrt.dll_printf]
cmp edi, ebx
jne 0x40af78
mov ebx, dword [ebp - 0x5c]
mov dword [esp], 0xa
call dword [sym.imp.msvcrt.dll_putchar]
lea eax, [ebp - 0x2c]
mov dword [ebp - 0x44], ebx
mov dword [esp + 4], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 8], ebx
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
lea eax, [ebp - 0x44]
mov dword [esp + 0xc], 0
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0x10], eax
mov dword [esp + 8], 0
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
mov edi, dword [ebp - 0x54]
call edi
sub esp, 0x18
mov dword [ebp - 0x60], eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov edx, dword fs:[0x18]
mov dword [eax + 4], 0x3d8
mov eax, dword [edx + 0x34]
mov dword [ebp - 0x5c], edx
mov dword [esp + 8], eax
mov dword [esp + 4], str._08lx_n
mov ecx, dword [ebp - 0x60]
mov dword [esp], ecx
call fcn.00401ac0
lea eax, [ebp - 0x2c]
mov dword [esp + 8], ebx
mov dword [esp + 4], eax
lea eax, [ebp - 0x1c]
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
mov edx, dword [ebp - 0x5c]
lea eax, [ebp - 0x44]
not byte [ebp + ebx - 0x1d]
mov dword [edx + 0x34], 0xdeadbeef
mov dword [ebp - 0x60], edx
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x1c]
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
call edi
sub esp, 0x18
mov dword [ebp - 0x5c], eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3df
xor eax, eax
mov dword [esp + 4], str.CryptDecrypt_should_failed__n
mov ecx, dword [ebp - 0x5c]
test ecx, ecx
sete al
mov dword [esp], eax
call fcn.00401ac0
call fcn.00412e10
mov edx, dword [ebp - 0x60]
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3e0
mov eax, dword [edx + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp + 8], eax
xor eax, eax
cmp dword [edx + 0x34], 0x80090005
sete al
mov dword [esp], eax
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3e1
mov eax, dword [ebp - 0x44]
mov dword [esp + 0xc], ebx
cmp eax, ebx
mov dword [esp + 8], eax
sete al
mov dword [esp + 4], str.length_incorrect__got__ld__expected__d_n
movzx eax, al
mov dword [esp], eax
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3e2
mov eax, dword [esi]
cmp dword [ebp - 0x3c], eax
je 0x40b518
mov eax, 1
mov edx, dword [ebp - 0x4c]
xor eax, 1
mov dword [esp + 4], str.decryption_incorrect__d_n
mov dword [esp], eax
mov dword [esp + 8], edx
call fcn.00401ac0
lea eax, [ebp - 0x2c]
mov dword [ebp - 0x44], ebx
mov dword [esp + 4], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 8], ebx
mov dword [esp], eax
call sub.msvcrt.dll_memcpy
lea eax, [ebp - 0x44]
mov dword [esp + 0xc], 0
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0x10], eax
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
mov eax, dword [ebp - 0x54]
call eax
sub esp, 0x18
mov ebx, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3e8
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp], ebx
mov dword [esp + 8], eax
call fcn.00401ac0
call fcn.00412e10
mov edx, dword [ebp - 0x50]
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3e9
mov eax, dword [ebp - 0x44]
mov dword [esp + 0xc], edx
cmp eax, edx
mov dword [esp + 8], eax
sete al
mov dword [esp + 4], str.length_incorrect__got__ld__expected__d_n
movzx eax, al
mov dword [esp], eax
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3ea
mov eax, dword [esi]
cmp dword [ebp - 0x3c], eax
je 0x40b500
mov eax, 1
mov ecx, dword [ebp - 0x4c]
xor eax, 1
mov dword [esp + 4], str.decryption_incorrect__d_n
mov dword [esp], eax
mov dword [esp + 8], ecx
call fcn.00401ac0
mov eax, dword [ebp - 0x50]
cmp eax, dword [ebp - 0x44]
jne 0x40b26e
mov dword [esp + 8], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 4], esi
mov dword [esp], eax
call sub.msvcrt.dll_memcmp
test eax, eax
je 0x40b31e
mov dword [esp + 4], str.expected
mov ebx, dword [sym.imp.msvcrt.dll_printf]
mov dword [esp], 0x416079
call ebx
mov eax, dword [ebp - 0x58]
lea edx, [eax + esi]
test eax, eax
je 0x40b2b2
mov dword [ebp - 0x50], esi
mov edi, edx
lea esi, [esi]
movzx eax, byte [esi]
add esi, 1
mov dword [esp], str.0x_02x_
mov dword [esp + 4], eax
call ebx
cmp edi, esi
jne 0x40b298
mov esi, dword [ebp - 0x50]
mov eax, dword [sym.imp.msvcrt.dll_putchar]
mov dword [esp], 0xa
lea edi, [ebp - 0x3c]
mov dword [ebp - 0x50], eax
call eax
mov ecx, dword [ebp - 0x44]
mov dword [ebp - 0x58], ecx
mov dword [esp + 4], 0x417722
mov dword [esp], 0x416079
call ebx
mov ecx, dword [ebp - 0x58]
mov eax, edi
add eax, ecx
test ecx, ecx
je 0x40b312
mov dword [ebp - 0x58], esi
mov esi, edi
mov edi, ebx
mov ebx, eax
lea esi, [esi]
movzx eax, byte [esi]
add esi, 1
mov dword [esp], str.0x_02x_
mov dword [esp + 4], eax
call edi
cmp esi, ebx
jne 0x40b2f8
mov esi, dword [ebp - 0x58]
mov dword [esp], 0xa
mov eax, dword [ebp - 0x50]
call eax
add dword [ebp - 0x4c], 1
mov eax, dword [ebp - 0x4c]
add esi, 0x4c
cmp eax, 4
jne 0x40ad0d
mov eax, dword [ebp - 0x48]
mov edi, dword [ebp - 0x68]
mov ebx, dword [sym.imp.advapi32.dll_CryptDestroyKey]
mov dword [esp], eax
call ebx
sub esp, 4
mov dword [ebp - 0x4c], eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3f4
mov esi, dword fs:[0x18]
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp + 8], eax
mov edx, dword [ebp - 0x4c]
mov dword [esp], edx
call fcn.00401ac0
mov ecx, 0x38
lea edx, [ebp - 0x48]
mov eax, 0x6601
call fcn.00407220
lea eax, [ebp - 0x40]
mov dword [ebp - 0x40], 2
mov dword [esp + 0xc], 0
mov dword [esp + 8], eax
mov dword [esp + 4], 4
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
call edi
sub esp, 0x10
mov edi, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x3fb
mov eax, dword [esi + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp + 8], eax
mov dword [esp], edi
call fcn.00401ac0
xor eax, eax
lea esi, [esi]
nop
mov byte [ebp + eax - 0x3c], al
add eax, 1
cmp eax, 0x10
jne 0x40b3e8
lea eax, [ebp - 0x44]
mov dword [ebp - 0x44], 0xd
mov dword [esp + 0x14], eax
lea eax, [ebp - 0x3c]
mov dword [esp + 0x18], 0x10
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], 0
mov dword [esp + 8], 1
mov dword [esp + 4], 0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
mov eax, dword [ebp - 0x64]
call eax
sub esp, 0x1c
mov esi, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x401
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp], esi
mov dword [esp + 8], eax
call fcn.00401ac0
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x402
cmp dword [ebp - 0x3c], 0x46428658
je 0x40b530
cmp dword [ebp - 0x3c], 0x6911fdb0
je 0x40b5e0
xor eax, eax
cmp dword [0x42b010], 2
je 0x40b619
mov dword [esp], eax
mov dword [esp + 4], str.DES_encryption_failed__n
call fcn.00401ac0
mov eax, dword [ebp - 0x48]
mov dword [esp], eax
call ebx
sub esp, 4
mov ebx, eax
call fcn.00412e10
mov dword [eax], 0x41605d
mov dword [eax + 4], 0x408
mov eax, dword fs:[0x18]
mov eax, dword [eax + 0x34]
mov dword [esp], ebx
mov dword [esp + 4], str._08lx_n
mov dword [esp + 8], eax
call fcn.00401ac0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [esi + 4]
cmp dword [ebp - 0x38], eax
jne 0x40b22c
xor eax, eax
jmp 0x40b231
mov eax, dword [esi + 4]
cmp dword [ebp - 0x38], eax
jne 0x40b13a
xor eax, eax
jmp 0x40b13f
cmp dword [ebp - 0x38], 0x62924b65
jne 0x40b487
cmp dword [ebp - 0x34], 0x37650fcf
jne 0x40b487
cmp dword [ebp - 0x30], 0xb9827a43
mov eax, 1
jne 0x40b487
jmp 0x40b4a3
cmp dword [ebp - 0x38], 0x62924b65
jne 0x40ac7c
cmp dword [ebp - 0x34], 0x37650fcf
jne 0x40ac7c
xor eax, eax
cmp dword [ebp - 0x30], 0xb9827a43
jne 0x40ac7c
jmp 0x40ac81
mov eax, 0x3a2
call fcn.00401310
mov eax, dword fs:[0x18]
mov edx, dword [eax + 0x34]
mov dword [esp + 4], str._08lx_n
mov dword [esp + 8], edx
cmp dword [eax + 0x34], 0x80090008
sete al
movzx eax, al
mov dword [esp], eax
call fcn.00401ac0
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
cmp dword [ebp - 0x38], 0x3a1b176
jne 0x40b494
cmp dword [ebp - 0x34], 0xaa23bcf7
jne 0x40b494
cmp dword [ebp - 0x30], 0x55c9c1d4
jne 0x40b494
mov edx, dword [0x42b050]
xor eax, eax
test edx, edx
sete al
jmp 0x40b4a3
cmp dword [ebp - 0x3c], 0xec2ac19b
je 0x40b629
xor eax, eax
jmp 0x40b4a3
cmp dword [ebp - 0x38], 0x140ff94a
jne 0x40b622
cmp dword [ebp - 0x34], 0xd3f6ed0a
jne 0x40b622
cmp dword [ebp - 0x30], 0xcf7addc
je 0x40b607
xor eax, eax
jmp 0x40b4a3