Function at 0x406bdf
Capabilities:
Encrypt or decrypt via wincrypt

Disassembly:
sub esp, 0x20
push ebx
push ebp
xor eax, eax
mov dword [esp + 0x20], edx
push esi
mov esi, ecx
xor ebx, ebx
mov ecx, dword [esp + 0x3c]
test ecx, ecx
push edi
sete al
mov dword [esp + 0x14], ebx
mov edi, dword [esi + 0x38]
mov dword [esp + 0x18], eax
mov eax, dword [esi + 0x50]
shr eax, 3
shr edi, 3
cmp dword [esi + 0x34], 0x6603
mov dword [esp + 0x10], eax
jne 0x406c22
push 0x18
pop edx
cmp edi, edx
cmovb edi, edx
test ecx, ecx
je 0x406c93
mov ecx, dword [esi + 0x4c]
cmp ecx, 0x800e
push 0x14
pop ebp
cmove ebp, eax
mov dword [esp + 0x24], ecx
push ebp
push 0x40
mov dword [esp + 0x24], ebp
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov ecx, eax
mov dword [esp + 0x14], ecx
test ecx, ecx
je 0x406ca1
mov edx, dword [esp + 0x40]
lea eax, [edx + 2]
mov dword [esp + 0x18], eax
mov ax, word [edx]
add edx, 2
cmp ax, bx
jne 0x406c5b
sub edx, dword [esp + 0x18]
sar edx, 1
push ebp
push ecx
mov ecx, 0x8004
lea eax, [edx + edx]
mov edx, dword [esp + 0x48]
push eax
lea eax, [ecx + 0xa]
cmp dword [esp + 0x30], eax
cmovne eax, ecx
mov ecx, eax
call fcn.004032e8
add esp, 0xc
mov ecx, eax
jmp 0x406ca5
mov ecx, dword [esp + 0x40]
mov dword [esp + 0x1c], ecx
mov ecx, dword [esp + 0x18]
jmp 0x406ca9
mov ecx, dword [esp + 0x18]
mov eax, dword [esp + 0x10]
mov ebp, dword [sym.imp.KERNEL32.dll_LocalFree]
test ecx, ecx
je 0x406dff
push eax
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov dword [esp + 0x18], eax
test eax, eax
je 0x406dff
push dword [esp + 0x10]
mov ecx, dword [esp + 0x18]
mov edx, dword [esp + 0x38]
push eax
push dword [esi + 0x4c]
xor eax, eax
test ecx, ecx
cmovne eax, dword [esp + 0x28]
push eax
push ecx
push dword [esp + 0x50]
mov ecx, dword [esp + 0x40]
push dword [esp + 0x50]
push dword [esi + 0x3c]
push dword [esi + 0x40]
call fcn.00406ab8
add esp, 0x24
test eax, eax
je 0x406df9
push edi
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov dword [esp + 0x40], eax
test eax, eax
je 0x406df9
mov edx, dword [esp + 0x18]
mov ecx, dword [esi + 0x4c]
push edi
push eax
push dword [esp + 0x18]
call fcn.004034cb
add esp, 0xc
test eax, eax
je 0x406df3
mov edx, dword [esp + 0x40]
lea eax, [esp + 0x2c]
mov ecx, dword [esi + 0x34]
push eax
lea eax, [esp + 0x24]
push eax
push ebx
push edi
call fcn.00403cc7
add esp, 0x10
test eax, eax
je 0x406de0
push dword [esi + 0x5c]
push 0x40
call dword [sym.imp.KERNEL32.dll_LocalAlloc]
mov edi, dword [esp + 0x44]
mov dword [edi], eax
test eax, eax
je 0x406dbb
push dword [esi + 0x5c]
push dword [esi + 0x60]
push eax
call fcn.0049fa90
mov ecx, dword [esp + 0x54]
add esp, 0xc
mov eax, dword [esi + 0x5c]
push ecx
mov dword [ecx], eax
push dword [edi]
push ebx
push 1
push ebx
push dword [esp + 0x34]
call dword [sym.imp.ADVAPI32.dll_CryptDecrypt]
mov ebx, eax
test ebx, ebx
jne 0x406dbb
push dword [edi]
call ebp
mov dword [edi], eax
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_dpapi_unprotect_blob___CryptDecrypt__0x_08x__n
call fcn.00409cda
pop ecx
pop ecx
push dword [esp + 0x20]
call dword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov ecx, dword [esp + 0x2c]
call fcn.004035a7
test eax, eax
jne 0x406df3
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_dpapi_unprotect_blob___kull_m_crypto_close_hprov_delete_container__0x_08x__n
jmp 0x406dec
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.ERROR_kull_m_dpapi_unprotect_blob___kull_m_crypto_hkey_session__0x_08x__n
call fcn.00409cda
pop ecx
pop ecx
push dword [esp + 0x40]
call ebp
push dword [esp + 0x18]
call ebp
mov eax, dword [esp + 0x14]
test eax, eax
je 0x406e0a
push eax
call ebp
pop edi
pop esi
pop ebp
mov eax, ebx
pop ebx
add esp, 0x20
ret