Function at 0x180008240
Capabilities:
Encrypt or decrypt via wincrypt

Disassembly:
mov qword [rsp + 0x18], rbx
mov qword [rsp + 0x20], r9
mov qword [rsp + 0x10], rdx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x50
mov r15d, dword [rcx + 0x18]
mov eax, 0x8004
mov rbx, rcx
xor ebp, ebp
cmp r15d, 0x8009
cmove r15d, eax
mov ecx, r15d
call fcn.180003ec0
mov ecx, dword [rbx + 0x1c]
mov esi, eax
call fcn.180003fe4
mov ecx, dword [rbx + 0x1c]
mov r12d, eax
call fcn.180003f50
mov r13d, dword [rsp + 0xb0]
mov r14d, eax
mov eax, esi
xor edx, edx
div r14d
lea eax, [r13 + 0x10]
lea rdi, [rbx + 0x28]
add esi, edx
lea ecx, [rbp + 0x40]
add eax, esi
mov dword [rdi], eax
lea edx, [r14 + rax]
call qword [sym.imp.KERNEL32.dll_LocalAlloc]
mov qword [rbx + 0x20], rax
test rax, rax
je 0x1800084b9
lea edx, [rbp + 0x10]
mov rcx, rax
call qword [sym.imp.cryptdll.dll_CDGenerateRandomBits]
mov r9, qword [rbx + 0x20]
mov rdx, qword [rsp + 0x98]
lea rax, [r9 + 0x10]
mov dword [rsp + 0x30], esi
lea r8d, [rbp + 0x14]
mov qword [rsp + 0x28], rax
mov ecx, r15d
mov dword [rsp + 0x20], 0x10
call fcn.1800033c0
test eax, eax
je 0x1800084a8
mov rdx, qword [rbx + 0x20]
mov r9, qword [rsp + 0xa8]
mov dword [rsp + 0x30], esi
add rdx, 0x10
mov r8d, esi
mov ecx, r15d
mov qword [rsp + 0x28], rdx
mov dword [rsp + 0x20], r13d
call fcn.1800033c0
test eax, eax
je 0x1800084a8
mov rcx, qword [rbx + 0x20]
mov edx, esi
mov r8d, r13d
add rcx, 0x10
add rcx, rdx
mov rdx, qword [rsp + 0xa8]
call fcn.18005bdd0
lea r13d, [r14 + r12]
lea ecx, [rbp + 0x40]
mov edx, r13d
call qword [sym.imp.KERNEL32.dll_LocalAlloc]
mov rsi, rax
test rax, rax
je 0x1800084a8
mov rdx, qword [rsp + 0x98]
mov dword [rsp + 0x40], 1
mov dword [rsp + 0x38], r13d
mov qword [rsp + 0x30], rax
mov eax, dword [rbx + 0x14]
lea r9, [rbx + 4]
mov dword [rsp + 0x28], eax
lea r8d, [rbp + 0x14]
mov ecx, r15d
mov dword [rsp + 0x20], 0x10
call fcn.18000354c
test eax, eax
je 0x18000849b
mov ecx, dword [rbx + 0x1c]
lea rax, [rsp + 0xb8]
xor r9d, r9d
mov qword [rsp + 0x28], rax
lea rax, [rsp + 0x90]
mov r8d, r12d
mov rdx, rsi
mov qword [rsp + 0x20], rax
call fcn.180003c10
test eax, eax
je 0x180008487
mov rcx, qword [rsp + 0x90]
lea r15d, [rbp + 1]
lea r8, [rsi + r12]
mov edx, r15d
xor r9d, r9d
call qword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
test eax, eax
je 0x180008459
mov ecx, dword [rdi]
mov rax, qword [rbx + 0x20]
xor r9d, r9d
add ecx, r14d
mov r8d, r15d
xor edx, edx
mov dword [rsp + 0x30], ecx
mov rcx, qword [rsp + 0x90]
mov qword [rsp + 0x28], rdi
mov qword [rsp + 0x20], rax
call qword [sym.imp.ADVAPI32.dll_CryptEncrypt]
mov ebp, eax
test eax, eax
je 0x180008445
sub dword [rdi], r14d
jmp 0x180008459
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str.ERROR_kull_m_dpapi_protect_masterkey_with_shaDerivedkey___CryptEncrypt__0x_08x__n
mov edx, eax
call fcn.18000af2c
mov rcx, qword [rsp + 0x90]
call qword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov rcx, qword [rsp + 0xb8]
call fcn.1800032f8
test eax, eax
jne 0x18000849b
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str.ERROR_kull_m_dpapi_protect_masterkey_with_shaDerivedkey___kull_m_crypto_close_hprov_delete_container__0x_08x__n
jmp 0x180008494
call qword [sym.imp.KERNEL32.dll_GetLastError]
lea rcx, str.ERROR_kull_m_dpapi_protect_masterkey_with_shaDerivedkey___kull_m_crypto_hkey_session__0x_08x__n
mov edx, eax
call fcn.18000af2c
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_LocalFree]
test ebp, ebp
jne 0x1800084b9
mov rcx, qword [rbx + 0x20]
call qword [sym.imp.KERNEL32.dll_LocalFree]
and dword [rdi], 0
mov qword [rbx + 0x20], rax
mov eax, ebp
mov rbx, qword [rsp + 0xa0]
add rsp, 0x50
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret