Function at 0x402000
Capabilities:
Encrypt or decrypt data via bcrypt

Disassembly:
push ebx
mov ebx, esp
sub esp, 8
and esp, 0xfffffff8
add esp, 4
push ebp
mov ebp, dword [ebx + 4]
mov dword [esp + 4], ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x428a4d
mov eax, dword fs:[0]
push eax
push ebx
sub esp, 0x1f0
mov eax, dword [0x436080]
xor eax, ebp
mov dword [ebp - 0x14], eax
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov esi, edx
mov edi, ecx
mov al, byte [ebx + 0xc]
push 0xb8
mov byte [ebp - 0x1f1], al
lea eax, [ebp - 0x1f0]
push 0
push eax
mov dword [ebp - 0x7c], 0
call fcn.0040d350
add esp, 4
lea ecx, [ebp - 0x1f0]
push 0x20
push edi
call fcn.00404820
mov dword [ebp - 4], 0
mov ecx, dword [ebp - 0x1f0]
mov eax, dword [ecx + 4]
test byte [ebp + eax - 0x1e4], 6
je 0x4020cf
mov edx, str.Failed_to_open_file:
mov ecx, 0x4373c0
call fcn.004085b0
cmp dword [edi + 0x14], 0xf
mov ecx, dword [edi + 0x10]
jbe 0x4020ad
mov edi, dword [edi]
push ecx
mov edx, edi
mov ecx, eax
call fcn.0040a140
add esp, 4
push eax
call fcn.00408850
add esp, 4
mov byte [ebp - 0x1f1], 0
jmp 0x4028f5
xorps xmm0, xmm0
mov dword [ebp - 0x48], 0
movq qword [ebp - 0x50], xmm0
mov eax, dword [ecx + 4]
mov word [ebp - 0x84], 1
mov byte [ebp - 0x1fb], 0
mov dword [ebp - 0x50], 0
mov edx, dword [ebp + eax - 0x1b8]
test edx, edx
movzx eax, word [ebp - 0x1fa]
mov word [ebp - 0x82], ax
sete cl
movzx eax, word [ebp - 0x1fa]
mov word [ebp - 0x1fa], ax
lea eax, [ebp - 0x50]
mov byte [ebp - 0x1fc], cl
mov dword [ebp - 0x4c], 0
mov dword [ebp - 0x48], 0
mov dword [ebp - 0x7c], eax
mov byte [ebp - 4], 2
mov ecx, eax
push dword [ebp - 0x84]
push 0
push dword [ebp - 0x1fc]
push edx
call fcn.0040a390
lea ecx, [ebp - 0x1e0]
mov byte [ebp - 4], 3
call fcn.00406fa0
test eax, eax
jne 0x402190
mov eax, dword [ebp - 0x1f0]
lea ecx, [ebp - 0x1f0]
push 0
add ecx, dword [eax + 4]
xor eax, eax
cmp dword [ecx + 0x38], eax
sete al
lea eax, [eax*4 + 2]
or eax, dword [ecx + 0xc]
push eax
call fcn.00401ec0
mov eax, dword [ebp - 0x50]
cmp eax, dword [ebp - 0x4c]
jne 0x4021c4
mov edx, str.File_is_empty:
mov ecx, 0x4373c0
call fcn.004085b0
cmp dword [edi + 0x14], 0xf
mov ecx, dword [edi + 0x10]
jbe 0x4021b2
mov edi, dword [edi]
push ecx
mov edx, edi
mov ecx, eax
call fcn.0040a140
add esp, 4
jmp 0x402248
push 0
push 0
push str.SHA256
lea eax, [ebp - 0x84]
mov dword [ebp - 0x84], 0
push eax
mov dword [ebp - 0x7c], 0
call dword [sym.imp.bcrypt.dll_BCryptOpenAlgorithmProvider]
test eax, eax
js 0x402239
push 0
push dword [ebx + 8]
lea eax, [ebp - 0x7c]
push esi
push 0
push 0
push eax
push dword [ebp - 0x84]
call dword [sym.imp.bcrypt.dll_BCryptCreateHash]
push 0
test eax, eax
js 0x40222d
push 0x20
lea eax, [ebp - 0x44]
push eax
push dword [ebp - 0x7c]
call dword [sym.imp.bcrypt.dll_BCryptFinishHash]
push dword [ebp - 0x7c]
test eax, eax
jns 0x402293
call dword [sym.imp.bcrypt.dll_BCryptDestroyHash]
push 0
push dword [ebp - 0x84]
call dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
mov edx, str.Failed_to_generate_key_and_IV.
mov ecx, 0x4373c0
call fcn.004085b0
push eax
call fcn.00408850
add esp, 4
mov byte [ebp - 0x1f1], 0
mov byte [ebp - 4], 0
mov ecx, dword [ebp - 0x50]
test ecx, ecx
je 0x4028f5
mov edx, dword [ebp - 0x48]
mov eax, ecx
sub edx, ecx
cmp edx, 0x1000
jb 0x4028d6
mov ecx, dword [eax - 4]
add edx, 0x23
sub eax, ecx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x402992
jmp 0x4028d6
call dword [sym.imp.bcrypt.dll_BCryptDestroyHash]
mov esi, dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
push 0
push dword [ebp - 0x84]
call esi
movaps xmm0, xmmword [0x4320a0]
lea eax, [ebp - 0x78]
movd dword [ebp - 0x24], xmm0
movaps xmm0, xmmword [0x4320b0]
push 0
movd dword [ebp - 0x20], xmm0
movaps xmm0, xmmword [str._b_t_n_v]
push 0
movd dword [ebp - 0x1c], xmm0
movaps xmm0, xmmword [0x4320d0]
push 0x431d6c
push eax
movd dword [ebp - 0x18], xmm0
mov dword [ebp - 0x78], 0
call dword [sym.imp.bcrypt.dll_BCryptOpenAlgorithmProvider]
test eax, eax
jns 0x402301
mov edx, str.Error_opening_AES_algorithm_provider.
jmp 0x40223e
push 0
push 0x20
push str.ChainingModeCBC
push str.ChainingMode
push dword [ebp - 0x78]
call dword [sym.imp.bcrypt.dll_BCryptSetProperty]
test eax, eax
jns 0x402340
mov edx, str.Error_setting_chaining_mode.
mov ecx, 0x4373c0
call fcn.004085b0
push eax
call fcn.00408850
add esp, 4
push 0
push dword [ebp - 0x78]
call esi
jmp 0x402251
push 0
lea eax, [ebp - 0x74]
mov dword [ebp - 0x70], 0
push eax
push 4
lea eax, [ebp - 0x70]
mov dword [ebp - 0x74], 0
push eax
push str.ObjectLength
push dword [ebp - 0x78]
call dword [sym.imp.bcrypt.dll_BCryptGetProperty]
test eax, eax
jns 0x402373
mov edx, str.Error_getting_object_length.
jmp 0x402321
mov esi, dword [ebp - 0x70]
xor eax, eax
mov dword [ebp - 0x64], 0
xorps xmm0, xmm0
movq qword [ebp - 0x6c], xmm0
mov dword [ebp - 0x7c], esi
mov dword [ebp - 0x6c], eax
mov dword [ebp - 0x68], eax
mov dword [ebp - 0x64], eax
test esi, esi
je 0x4023fc
cmp esi, 0x7fffffff
ja 0x402997
cmp esi, 0x1000
jb 0x4023d4
lea eax, [esi + 0x23]
cmp eax, esi
jbe 0x40299c
push eax
call fcn.0040b7bf
mov ecx, eax
add esp, 4
test ecx, ecx
je 0x402992
lea eax, [ecx + 0x23]
and eax, 0xffffffe0
mov dword [eax - 4], ecx
jmp 0x4023dd
push esi
call fcn.0040b7bf
add esp, 4
push dword [ebp - 0x7c]
add esi, eax
mov dword [ebp - 0x6c], eax
push 0
push eax
mov dword [ebp - 0x64], esi
call fcn.0040d350
mov eax, dword [ebp - 0x6c]
add esp, 0xc
mov dword [ebp - 0x68], esi
mov esi, dword [ebp - 0x70]
push 0
push 0x20
lea ecx, [ebp - 0x44]
mov byte [ebp - 4], 9
push ecx
push esi
push eax
lea eax, [ebp - 0x80]
mov dword [ebp - 0x80], 0
push eax
push dword [ebp - 0x78]
call dword [sym.imp.bcrypt.dll_BCryptGenerateSymmetricKey]
test eax, eax
jns 0x40243c
mov edx, str.Error_generating_symmetric_key.
mov ecx, 0x4373c0
call fcn.004085b0
push eax
call fcn.00408850
add esp, 4
jmp 0x402497
mov ecx, dword [ebp - 0x4c]
lea edx, [ebp - 0x60]
mov eax, dword [ebp - 0x50]
sub ecx, eax
push 0
push edx
push 0
push 0
push 0x10
lea edx, [ebp - 0x24]
mov dword [ebp - 0x60], 0
push edx
push 0
push ecx
push eax
push dword [ebp - 0x80]
call dword [sym.imp.bcrypt.dll_BCryptEncrypt]
mov cl, byte [ebp - 0x1f1]
test cl, cl
je 0x4024af
test eax, eax
jns 0x4024af
mov edx, str.Error_calculating_ciphertext_size.
mov ecx, 0x4373c0
call fcn.004085b0
push eax
call fcn.00408850
add esp, 4
push dword [ebp - 0x80]
call dword [sym.imp.bcrypt.dll_BCryptDestroyKey]
mov eax, dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
push 0
push dword [ebp - 0x78]
call eax
mov byte [ebp - 0x1f1], 0
jmp 0x402880
mov eax, dword [ebp - 0x4c]
xorps xmm0, xmm0
sub eax, dword [ebp - 0x50]
test cl, cl
push ecx
cmovne eax, dword [ebp - 0x60]
lea ecx, [ebp - 0x5c]
push eax
movq qword [ebp - 0x5c], xmm0
mov dword [ebp - 0x54], 0
call fcn.00403a20
push 0
mov byte [ebp - 4], 0xc
lea edx, [ebp - 0x60]
mov eax, dword [ebp - 0x5c]
mov ecx, dword [ebp - 0x58]
mov esi, dword [ebp - 0x4c]
sub ecx, eax
sub esi, dword [ebp - 0x50]
cmp byte [ebp - 0x1f1], 0
push edx
mov edx, dword [ebp - 0x50]
push ecx
push eax
push 0x10
lea eax, [ebp - 0x24]
push eax
push 0
push esi
push edx
push dword [ebp - 0x80]
je 0x40250f
call dword [sym.imp.bcrypt.dll_BCryptEncrypt]
jmp 0x402515
call dword [sym.imp.bcrypt.dll_BCryptDecrypt]
test eax, eax
jns 0x40256d
cmp byte [ebp - 0x1f1], 0
mov eax, str.Decryption
mov edx, str.Encryption
mov ecx, 0x4373c0
cmove edx, eax
call fcn.004085b0
mov edx, str._failed.
mov ecx, eax
call fcn.004085b0
push eax
call fcn.00408850
add esp, 4
push dword [ebp - 0x80]
call dword [sym.imp.bcrypt.dll_BCryptDestroyKey]
mov eax, dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
push 0
push dword [ebp - 0x78]
call eax
mov byte [ebp - 0x1f1], 0
jmp 0x402833
mov edx, dword [ebp - 0x58]
mov esi, dword [ebp - 0x5c]
sub edx, esi
mov ecx, dword [ebp - 0x60]
cmp ecx, edx
jae 0x402584
lea eax, [esi + ecx]
mov dword [ebp - 0x58], eax
jmp 0x4025b2
jbe 0x4025b2
mov eax, dword [ebp - 0x54]
sub eax, esi
cmp ecx, eax
jbe 0x40259b
push ecx
push ecx
lea ecx, [ebp - 0x5c]
call fcn.0040a700
jmp 0x4025b2
mov eax, dword [ebp - 0x58]
sub ecx, edx
push ecx
push 0
push eax
lea esi, [eax + ecx]
call fcn.0040d350
add esp, 0xc
mov dword [ebp - 0x58], esi
push dword [ebp - 0x80]
call dword [sym.imp.bcrypt.dll_BCryptDestroyKey]
mov eax, dword [sym.imp.bcrypt.dll_BCryptCloseAlgorithmProvider]
push 0
push dword [ebp - 0x78]
call eax
push 0xb0
lea eax, [ebp - 0x138]
push 0
push eax
call fcn.0040d350
add esp, 0xc
mov esi, edi
cmp dword [edi + 0x14], 0xf
jbe 0x4025e7
mov esi, dword [edi]
xorps xmm0, xmm0
mov dword [ebp - 0x138], 0x432024
movups xmmword [ebp - 0xc8], xmm0
mov dword [ebp - 0xa8], 0
movlpd qword [ebp - 0xb8], xmm0
movlpd qword [ebp - 0xb0], xmm0
mov dword [ebp - 0xa4], 0
mov dword [ebp - 0xa0], 0
mov dword [ebp - 0x98], 0
mov dword [ebp - 0x94], 0
mov byte [ebp - 0x90], 0
mov byte [ebp - 4], 0xe
lea eax, [ebp - 0x134]
push 0
push eax
lea ecx, [ebp - 0xd0]
mov dword [ebp - 0x7c], 1
mov dword [ebp - 0xd0], vtable.std::basic_ostream_char__struct_std::char_traits_char__.0
mov dword [ebp - 0xd4], 0x60
call fcn.00408330
mov dword [ebp - 4], 0x10
mov eax, dword [ebp - 0x138]
mov eax, dword [eax + 4]
mov dword [ebp + eax - method.std::basic_ofstream_char__struct_std::char_traits_char__.virtual_0], vtable.std::basic_ofstream_char__struct_std::char_traits_char__.0
mov eax, dword [ebp - 0x138]
mov ecx, dword [eax + 4]
lea eax, [ecx - 0x68]
mov dword [ebp + ecx - 0x13c], eax
lea ecx, [ebp - 0x134]
call fcn.00407990
push ecx
push 0x32
push esi
lea ecx, [ebp - 0x134]
mov byte [ebp - 4], 0x11
call fcn.004077c0
test eax, eax
jne 0x4026f0
mov eax, dword [ebp - 0x138]
lea ecx, [ebp - 0x138]
push 0
add ecx, dword [eax + 4]
xor eax, eax
cmp dword [ecx + 0x38], eax
sete al
lea eax, [eax*4 + 2]
or eax, dword [ecx + 0xc]
push eax
call fcn.00401ec0
mov eax, dword [ebp - 0x138]
mov eax, dword [eax + 4]
mov dword [ebp + eax - method.std::basic_ofstream_char__struct_std::char_traits_char__.virtual_0], vtable.std::basic_ofstream_char__struct_std::char_traits_char__.0
mov eax, dword [ebp - 0x138]
mov ecx, dword [eax + 4]
lea eax, [ecx - 0x68]
mov dword [ebp + ecx - 0x13c], eax
mov byte [ebp - 4], 0x12
mov eax, dword [ebp - 0x138]
mov eax, dword [eax + 4]
test byte [ebp + eax - 0x12c], 6
je 0x402767
mov edx, str.Failed_to_write_to_file:
mov ecx, 0x4373c0
call fcn.004085b0
cmp dword [edi + 0x14], 0xf
mov ecx, dword [edi + 0x10]
jbe 0x402748
mov edi, dword [edi]
push ecx
mov edx, edi
mov ecx, eax
call fcn.0040a140
add esp, 4
push eax
call fcn.00408850
add esp, 4
mov byte [ebp - 0x1f1], 0
jmp 0x4027bd
mov ecx, dword [ebp - 0x58]
mov eax, dword [ebp - 0x5c]
sub ecx, eax
push 0
push ecx
push eax
lea ecx, [ebp - 0x138]
call fcn.00405450
lea ecx, [ebp - 0x134]
call fcn.00406fa0
test eax, eax
jne 0x4027b6
mov eax, dword [ebp - 0x138]
lea ecx, [ebp - 0x138]
push 0
add ecx, dword [eax + 4]
xor eax, eax
cmp dword [ecx + 0x38], eax
sete al
lea eax, [eax*4 + 2]
or eax, dword [ecx + 0xc]
push eax
call fcn.00401ec0
mov byte [ebp - 0x1f1], 1
mov eax, dword [ebp - 0x138]
mov eax, dword [eax + 4]
mov dword [ebp + eax - method.std::basic_ofstream_char__struct_std::char_traits_char__.virtual_0], vtable.std::basic_ofstream_char__struct_std::char_traits_char__.0
mov eax, dword [ebp - 0x138]
mov ecx, dword [eax + 4]
lea eax, [ecx - 0x68]
mov dword [ebp + ecx - 0x13c], eax
lea ecx, [ebp - 0x134]
call fcn.00404770
mov eax, dword [ebp - 0x138]
mov eax, dword [eax + 4]
mov dword [ebp + eax - method.std::basic_ostream_char__struct_std::char_traits_char__.virtual_0], vtable.std::basic_ostream_char__struct_std::char_traits_char__.0
mov eax, dword [ebp - 0x138]
mov ecx, dword [eax + 4]
lea eax, [ecx - 8]
mov dword [ebp + ecx - 0x13c], eax
lea eax, [ebp - 0xd0]
mov byte [ebp - 4], 0x15
push eax
mov dword [ebp - 0xd0], vtable.std::ios_base.0
call fcn.0040b077
add esp, 4
mov byte [ebp - 4], 9
mov ecx, dword [ebp - 0x5c]
test ecx, ecx
je 0x402880
mov edx, dword [ebp - 0x54]
mov eax, ecx
sub edx, ecx
cmp edx, 0x1000
jb 0x402861
mov ecx, dword [eax - 4]
add edx, 0x23
sub eax, ecx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x402992
push edx
push ecx
call fcn.0040b7f4
add esp, 8
mov dword [ebp - 0x5c], 0
mov dword [ebp - 0x58], 0
mov dword [ebp - 0x54], 0
mov byte [ebp - 4], 3
mov ecx, dword [ebp - 0x6c]
test ecx, ecx
je 0x402258
mov edx, dword [ebp - 0x64]
mov eax, ecx
sub edx, ecx
cmp edx, 0x1000
jb 0x4028b2
mov ecx, dword [eax - 4]
add edx, 0x23
sub eax, ecx
add eax, 0xfffffffc
cmp eax, 0x1f
ja 0x402992
push edx
push ecx
call fcn.0040b7f4
add esp, 8
mov dword [ebp - 0x6c], 0
mov dword [ebp - 0x68], 0
mov dword [ebp - 0x64], 0
jmp 0x402258
push edx
push ecx
call fcn.0040b7f4
add esp, 8
mov dword [ebp - 0x50], 0
mov dword [ebp - 0x4c], 0
mov dword [ebp - 0x48], 0
mov eax, dword [ebp - 0x1f0]
mov eax, dword [eax + 4]
mov dword [ebp + eax - method.std::basic_ifstream_char__struct_std::char_traits_char__.virtual_0], vtable.std::basic_ifstream_char__struct_std::char_traits_char__.0
mov eax, dword [ebp - 0x1f0]
mov ecx, dword [eax + 4]
lea eax, [ecx - 0x70]
mov dword [ebp + ecx - 0x1f4], eax
lea ecx, [ebp - 0x1e0]
call fcn.00404770
mov eax, dword [ebp - 0x1f0]
mov eax, dword [eax + 4]
mov dword [ebp + eax - method.std::basic_istream_char__struct_std::char_traits_char__.virtual_0], vtable.std::basic_istream_char__struct_std::char_traits_char__.0
mov eax, dword [ebp - 0x1f0]
mov edx, dword [eax + 4]
lea ecx, [edx - 0x18]
mov dword [ebp + edx - 0x1f4], ecx
lea eax, [ebp - 0x180]
mov dword [ebp - 4], 0x16
push eax
mov dword [ebp - method.std::ios_base.virtual_0], vtable.std::ios_base.0
call fcn.0040b077
mov al, byte [ebp - 0x1f1]
add esp, 4
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
mov ecx, dword [ebp - 0x14]
xor ecx, ebp
call fcn.0040b7ac
mov esp, ebp
pop ebp
mov esp, ebx
pop ebx
ret
call fcn.00413bd5
call fcn.0040a100
call fcn.00401340
int3