Function at 0x140004704
Capabilities:
Create new key via cryptacquirecontext

Disassembly:
mov rax, rsp
mov qword [rax + 0x18], rbx
mov dword [rax + 0x20], r9d
mov qword [rax + 0x10], rdx
mov dword [rax + 8], ecx
push rbp
push rsi
push rdi
push r12
push r13
push r14
push r15
sub rsp, 0x40
xor edi, edi
mov ebp, r8d
mov r12d, edi
call fcn.140012e94
mov r15, rax
cmp rax, rdi
je 0x1400049b4
mov r13, qword [rsp + 0xa8]
lea r9d, [rdi + 0x18]
xor r8d, r8d
mov rdx, rax
mov rcx, r13
mov dword [rsp + 0x20], 8
call qword [sym.imp.ADVAPI32.dll_CryptAcquireContextW]
cmp eax, edi
je 0x1400049ab
mov rcx, qword [r13]
lea r9, [rsp + 0x38]
lea edx, [rdi + 1]
mov r8d, 0x2000001
mov qword [rsp + 0x38], rdi
call qword [sym.imp.ADVAPI32.dll_CryptGenKey]
cmp eax, edi
je 0x14000498d
mov rcx, qword [rsp + 0x38]
lea rax, [rsp + 0x30]
lea ebx, [rdi + 7]
mov qword [rsp + 0x28], rax
mov r8d, ebx
xor r9d, r9d
xor edx, edx
mov qword [rsp + 0x20], rdi
call qword [sym.imp.ADVAPI32.dll_CryptExportKey]
cmp eax, edi
je 0x14000498d
mov edx, dword [rsp + 0x30]
lea ecx, [rdi + 0x40]
call qword [sym.imp.KERNEL32.dll_LocalAlloc]
mov r14, rax
cmp rax, rdi
je 0x14000498d
mov rcx, qword [rsp + 0x38]
lea rax, [rsp + 0x30]
xor r9d, r9d
mov qword [rsp + 0x28], rax
mov r8d, ebx
xor edx, edx
mov qword [rsp + 0x20], r14
call qword [sym.imp.ADVAPI32.dll_CryptExportKey]
cmp eax, edi
je 0x140004984
mov rcx, qword [rsp + 0x38]
call qword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
mov qword [rsp + 0x38], rdi
mov ebx, dword [r14 + 0xc]
shr ebx, 3
mov dword [r14 + 0x10], 1
xor edx, edx
lea eax, [rbx + rbx]
lea rsi, [rax + r14 + 0x14]
mov eax, ebx
shr eax, 1
lea rcx, [rsi + 1]
mov byte [rsi], 1
dec eax
mov r8d, eax
mov edi, eax
call sub.msvcrt.dll_memset
mov rax, rbx
mov r8, rdi
shr rax, 1
xor edx, edx
add rsi, rax
lea rcx, [rsi + 1]
mov byte [rsi], 1
call sub.msvcrt.dll_memset
lea rcx, [rsi + rbx + 1]
mov r8, rdi
xor edx, edx
mov byte [rsi + rbx], 1
call sub.msvcrt.dll_memset
mov r8d, dword [rsp + 0x30]
mov rcx, qword [r13]
lea r11, [rsp + 0x38]
xor edi, edi
xor r9d, r9d
mov qword [rsp + 0x28], r11
mov rdx, r14
mov dword [rsp + 0x20], edi
call qword [sym.imp.ADVAPI32.dll_CryptImportKey]
cmp eax, edi
je 0x140004984
lea edx, [rdi + 0x4c]
lea ecx, [rdi + 0x40]
mov dword [rsp + 0x30], edx
call qword [sym.imp.KERNEL32.dll_LocalAlloc]
mov rbx, rax
cmp rax, rdi
je 0x140004984
mov byte [rax], 1
mov byte [rax + 1], 2
mov word [rax + 2], di
mov eax, dword [rsp + 0x80]
lea rdx, [rbx + 8]
mov dword [rbx + 4], eax
mov dword [rdx], 0xa400
add rdx, 4
movsxd rax, ebp
cmp ebp, edi
jbe 0x140004902
mov r8, qword [rsp + 0x88]
mov rcx, rdx
mov r9, rbp
lea r8, [rax + r8 - 1]
mov al, byte [r8]
dec r8
mov byte [rcx], al
inc rcx
sub r9, 1
jne 0x1400048f1
mov r8d, dword [rsp + 0x30]
lea ecx, [rbp + 1]
mov r9d, edi
mov rax, r8
add rdx, rcx
sub rax, rbp
cmp rax, 0xf
je 0x140004941
cmp byte [rdx], dil
jne 0x140004929
mov byte [rdx], 0x42
mov r8d, dword [rsp + 0x30]
inc r9d
mov ecx, r8d
inc rdx
sub rcx, rbp
mov eax, r9d
sub rcx, 0xf
cmp rax, rcx
jb 0x14000491c
lea eax, [r8 - 2]
mov rdx, rbx
mov byte [rax + rbx], 2
mov rax, qword [rsp + 0xa0]
mov r9, qword [rsp + 0x38]
mov r8d, dword [rsp + 0x30]
mov rcx, qword [r13]
mov qword [rsp + 0x28], rax
mov eax, dword [rsp + 0x98]
mov dword [rsp + 0x20], eax
call qword [sym.imp.ADVAPI32.dll_CryptImportKey]
mov rcx, rbx
mov r12d, eax
call qword [sym.imp.KERNEL32.dll_LocalFree]
mov rcx, r14
call qword [sym.imp.KERNEL32.dll_LocalFree]
mov rcx, qword [rsp + 0x38]
cmp rcx, rdi
je 0x14000499d
call qword [sym.imp.ADVAPI32.dll_CryptDestroyKey]
cmp r12d, edi
jne 0x1400049ab
mov rcx, qword [r13]
call fcn.140003d2c
mov rcx, r15
call qword [sym.imp.KERNEL32.dll_LocalFree]
mov eax, r12d
mov rbx, qword [rsp + 0x90]
add rsp, 0x40
pop r15
pop r14
pop r13
pop r12
pop rdi
pop rsi
pop rbp
ret