ZMQ\_CURVE\_KEYPAIR(3) 0MQ Manual ZMQ\_CURVE\_KEYPAIR(3)

# [NAME](#NAME)

zmq\_curve\_keypair - generate a new CURVE keypair

# [SYNOPSIS](#SYNOPSIS)

**int zmq\_curve\_keypair (char \*z85\_public\_key, char \*z85\_secret\_key);**

# [DESCRIPTION](#DESCRIPTION)

The *zmq\_curve\_keypair()* function shall return a newly generated random keypair consisting of a public key and a secret key. The caller provides two buffers, each at least 41 octets large, in which this method will store the keys. The keys are encoded using [**zmq\_z85\_encode**(3)](/man/os/zeromq/zmq_z85_encode.3).

# [RETURN VALUE](#RETURN_VALUE)

The *zmq\_curve\_keypair()* function shall return 0 if successful, else it shall return -1 and set *errno* to one of the values defined below.

# [ERRORS](#ERRORS)

**ENOTSUP**

The libzmq library was not built with cryptographic support (libsodium).

# [EXAMPLE](#EXAMPLE)

**Generating a new CURVE keypair**.

```
char public_key [41];
char secret_key [41];
int rc = zmq_curve_keypair (public_key, secret_key);
assert (rc == 0);
```

# [SEE ALSO](#SEE_ALSO)

[**zmq\_z85\_decode**(3)](/man/os/zeromq/zmq_z85_decode.3) [**zmq\_z85\_encode**(3)](/man/os/zeromq/zmq_z85_encode.3) [**zmq\_curve**(7)](/man/os/zeromq/zmq_curve.7)

# [AUTHORS](#AUTHORS)

This page was written by the 0MQ community. To make a change please read the 0MQ Contribution Policy at **http://www.zeromq.org/docs:contributing**.

10/26/2026 0MQ 4.3.5

---

Document: zmq_curve_keypair(3) from zeromq 4.3.5-r15 (Chainguard OS)
Source: https://github.com/zeromq/libzmq
