---
name: "CryptGenKey"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/CryptGenKey"
---

# CryptGenKey(3w)

## NAME

**CryptGenKey** (ADVAPI32.@)

## SYNOPSIS

BOOL CryptGenKey\
  (\
   HCRYPTPROV *hProv*,\
   ALG\_ID     *Algid*,\
   DWORD      *dwFlags*,\
   HCRYPTKEY\* *phKey*\
  )

## DESCRIPTION

Generates a random cryptographic session key or a pub/priv key pair.

## PARAMS

*hProv* **\[In\]**  Handle to a **CSP**.

*Algid* **\[In\]**  Algorithm to use to make key.

*dwFlags* **\[In\]**  Specifies type of key to make.

*phKey* **\[In\]**  Address of the handle to which the new key is copied.

## RETURNS

**Success:** **TRUE**

**Failure:** **FALSE**

## IMPLEMENTATION

Declared in **"wincrypt.h"**.

Implemented in **"dlls/advapi32/crypt.c"**.

Debug channel **"crypt"**.
