Function at 0x140386480
Capabilities:
Create new key via cryptacquirecontext
Encrypt data using aes via winapi

Disassembly:
mov qword [rsp + 8], rbx
mov qword [rsp + 0x18], rbp
mov qword [rsp + 0x20], rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x30
xor r13d, r13d
mov rdi, r8
mov r12, rdx
mov rbp, rcx
test rdx, rdx
je 0x14038668a
test r8, r8
je 0x14038668a
lea r14, [rcx + 0x20]
mov rbx, qword [r14]
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapFree]
lea rsi, [rbp + 0x10]
mov qword [r14], r13
mov rbx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapFree]
lea rbx, [rbp + 0x30]
mov qword [rsi], r13
mov rcx, qword [rbx]
lea r15, [rbp + 0x18]
mov dword [r15], r13d
mov qword [rsp + 0x68], rbx
test rcx, rcx
je 0x140386517
call qword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov qword [rbx], r13
lea r13, [rbp + 0x38]
cmp qword [r13], 0
jne 0x140386562
mov r9d, reloc.OLEAUT32.dll_SafeArrayGetElement
mov dword [rsp + 0x20], 0xf0000000
lea r8, str.Microsoft_Enhanced_RSA_and_AES_Cryptographic_Provider
xor edx, edx
mov rcx, r13
call qword [sym.imp.ADVAPI32.dll_CryptAcquireContextW]
test eax, eax
jne 0x140386562
call qword [sym.imp.KERNEL32.dll_GetLastError]
movzx edi, ax
or edi, 0x80070000
xor r13d, r13d
test eax, eax
cmovle edi, eax
jmp 0x140386684
mov rbx, qword [rsi]
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapFree]
xor ecx, ecx
or r8, 0xffffffffffffffff
mov qword [rsi], rcx
mov rax, r8
inc rax
cmp word [rdi + rax*2], cx
jne 0x140386585
mov dword [r15], eax
lea ecx, [rax + 1]
mov eax, 2
mul rcx
mov rbx, rax
cmovo rbx, r8
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
mov qword [rsi], rax
mov rcx, rax
test rax, rax
jne 0x1403865cf
mov edi, 0x8007000e
xor r13d, r13d
jmp 0x14038669b
mov edx, dword [r15]
mov r8, rdi
inc edx
call fcn.1400797ac
mov edi, eax
test eax, eax
jne 0x140386681
lea rdx, str.http:__www.w3.org_2001_04_xmlencaes128_cbc
mov rcx, r12
call sub.msvcrt.dll_wcscmp
test eax, eax
jne 0x140386607
mov edx, 0x660e
mov dword [rbp + 0xc], 1
jmp 0x140386647
lea rdx, str.http:__www.w3.org_2001_04_xmlencaes192_cbc
mov rcx, r12
call sub.msvcrt.dll_wcscmp
test eax, eax
jne 0x140386628
mov edx, 0x660f
mov dword [rbp + 0xc], 2
jmp 0x140386647
lea rdx, str.http:__www.w3.org_2001_04_xmlencaes256_cbc
mov rcx, r12
call sub.msvcrt.dll_wcscmp
test eax, eax
jne 0x140386677
mov edx, 0x6610
mov dword [rbp + 0xc], 3
mov r9, qword [rsp + 0x68]
mov r8d, 1
mov rcx, qword [r13]
call qword [sym.imp.ADVAPI32.dll_CryptGenKey]
xor r13d, r13d
test eax, eax
jne 0x1403866d2
call qword [sym.imp.KERNEL32.dll_GetLastError]
movzx edi, ax
or edi, 0x80070000
jmp 0x140386558
mov edi, 0x80049e2e
jmp 0x1403865c7
xor r13d, r13d
test edi, edi
jns 0x1403866d2
jmp 0x14038669b
mov edi, 0x80070057
lea r14, [rcx + 0x20]
lea rsi, [rcx + 0x10]
lea r15, [rcx + 0x18]
mov rbx, qword [r14]
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapFree]
mov rbx, qword [rsi]
mov qword [r14], r13
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov r8, rbx
xor edx, edx
mov rcx, rax
call qword [sym.imp.KERNEL32.dll_HeapFree]
mov qword [rsi], r13
mov dword [r15], r13d
mov rbx, qword [rsp + 0x60]
mov eax, edi
mov rbp, qword [rsp + 0x70]
mov rsi, qword [rsp + 0x78]
add rsp, 0x30
pop r15
pop r14
pop r13
pop r12
pop rdi
ret