---
name: "archive_write_set_passphrase"
section: "3"
platform: "linux"
package: "libarchive"
version: "3.8.11-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/archive_write_set_passphrase"
---

# archive\_write\_set\_passphrase(3)

functions for writing encrypted archives

## NAME

**archive\_write\_set\_passphrase**, **archive\_write\_set\_passphrase\_callback** – functions for writing encrypted archives

## LIBRARY

Streaming Archive Library (libarchive, -larchive)

## SYNOPSIS

**#include \<archive.h\>**

*int*\

**archive\_write\_set\_passphrase**(*struct archive \**, *const char \*passphrase*);

*int*\

**archive\_write\_set\_passphrase\_callback**(*struct archive \**, *void \*client\_data*, *archive\_passphrase\_callback \**);

## DESCRIPTION

- **archive\_write\_set\_passphrase**()

  Set a passphrase for writing an encrypted archive. If *passphrase* is NULL or empty, this function will do nothing and **ARCHIVE\_FAILED** will be returned. Otherwise, **ARCHIVE\_OK** will be returned.

- **archive\_write\_set\_passphrase\_callback**()

  Register a callback function that will be invoked to get a passphrase for encryption if the passphrase was not set by the **archive\_write\_set\_passphrase**() function.

## SEE ALSO

[tar(1)](/tar/1.md), [archive\_write(3)](/archive_write/3.md), [archive\_write\_set\_options(3)](/archive_write_set_options/3.md), [libarchive(3)](/libarchive/3.md)
