Function at 0x140008eac
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.1400047ac
mov ecx, dword [rbx + 0x1c]
mov esi, eax
call fcn.1400048d0
mov ecx, dword [rbx + 0x1c]
mov r12d, eax
call fcn.14000483c
mov r13d, dword [rsp + 0xb0]
lea rdi, [rbx + 0x28]
mov r14d, eax
lea ecx, [rbp + 0x40]
mov eax, esi
xor edx, edx
div r14d
lea eax, [r13 + 0x10]
add esi, edx
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 0x140009125
lea edx, [rbp + 0x10]
mov rcx, rax
call qword [sym.imp.cryptdll.dll_CDGenerateRandomBits]
mov r9, qword [rbx + 0x20]
lea r8d, [rbp + 0x14]
mov rdx, qword [rsp + 0x98]
mov ecx, r15d
mov dword [rsp + 0x30], esi
lea rax, [r9 + 0x10]
mov qword [rsp + 0x28], rax
mov dword [rsp + 0x20], 0x10
call fcn.140003cc8
test eax, eax
je 0x140009114
mov rdx, qword [rbx + 0x20]
mov r8d, esi
mov r9, qword [rsp + 0xa8]
add rdx, 0x10
mov dword [rsp + 0x30], esi
mov ecx, r15d
mov qword [rsp + 0x28], rdx
mov dword [rsp + 0x20], r13d
call fcn.140003cc8
test eax, eax
je 0x140009114
mov rcx, qword [rbx + 0x20]
mov r8d, r13d
add rcx, 0x10
mov edx, esi
add rcx, rdx
mov rdx, qword [rsp + 0xa8]
call sub.VCRUNTIME140.dll_memcpy
lea r13d, [r14 + r12]
mov edx, r13d
lea ecx, [rbp + 0x40]
call qword [sym.imp.KERNEL32.dll_LocalAlloc]
mov rsi, rax
test rax, rax
je 0x140009114
mov rdx, qword [rsp + 0x98]
lea r9, [rbx + 4]
mov dword [rsp + 0x40], 1
lea r8d, [rbp + 0x14]
mov dword [rsp + 0x38], r13d
mov ecx, r15d
mov qword [rsp + 0x30], rax
mov eax, dword [rbx + 0x14]
mov dword [rsp + 0x28], eax
mov dword [rsp + 0x20], 0x10
call fcn.140003e54
test eax, eax
je 0x140009107
mov ecx, dword [rbx + 0x1c]
lea rax, [rsp + 0xb8]
mov qword [rsp + 0x28], rax
xor r9d, r9d
lea rax, [rsp + 0x90]
mov r8d, r12d
mov rdx, rsi
mov qword [rsp + 0x20], rax
call fcn.1400044fc
test eax, eax
je 0x1400090f3
mov rcx, qword [rsp + 0x90]
lea r15d, [rbp + 1]
mov edx, r15d
lea r8, [rsi + r12]
xor r9d, r9d
call qword [sym.imp.ADVAPI32.dll_CryptSetKeyParam]
test eax, eax
je 0x1400090c5
mov ecx, dword [rdi]
xor r9d, r9d
mov rax, qword [rbx + 0x20]
add ecx, r14d
mov dword [rsp + 0x30], ecx
mov r8d, r15d
mov rcx, qword [rsp + 0x90]
xor edx, edx
mov qword [rsp + 0x28], rdi
mov qword [rsp + 0x20], rax
call qword [sym.imp.ADVAPI32.dll_CryptEncrypt]
mov ebp, eax
test eax, eax
je 0x1400090b1
sub dword [rdi], r14d
jmp 0x1400090c5
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, eax
lea rcx, str.ERROR_kull_m_dpapi_protect_masterkey_with_shaDerivedkey___CryptEncrypt__0x_08x__n
call fcn.14000bdc4
mov rcx, qword [rsp + 0x90]
call qword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov rcx, qword [rsp + 0xb8]
call fcn.140003c00
test eax, eax
jne 0x140009107
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 0x140009100
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.14000bdc4
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_LocalFree]
test ebp, ebp
jne 0x140009125
mov rcx, qword [rbx + 0x20]
call qword [sym.imp.KERNEL32.dll_LocalFree]
and dword [rdi], 0
mov qword [rbx + 0x20], rax
mov rbx, qword [rsp + 0xa0]
mov eax, ebp
add rsp, 0x50
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret