Skip to main content
DiffieHellmanGroup - node__crypto.d.ts - Node documentation
type alias DiffieHellmanGroup

Usage in Deno

```typescript import { type DiffieHellmanGroup } from "node:node__crypto.d.ts"; ```

Definition

Omit<DiffieHellman, "setPublicKey" | "setPrivateKey">
variable DiffieHellmanGroup
The `DiffieHellmanGroup` class takes a well-known modp group as its argument. It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. ```js const { createDiffieHellmanGroup } = await import('node:crypto'); const dh = createDiffieHellmanGroup('modp1'); ``` The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): ```bash $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h modp1 # 768 bits modp2 # 1024 bits modp5 # 1536 bits modp14 # 2048 bits modp15 # etc. modp16 modp17 modp18 ```

Type