---
name: "archive_read_add_passphrase"
section: "3"
platform: "macos"
package: "libarchive"
version: "167.120.3"
release: "macOS 26.5"
platforms: ["linux", "macos"]
url: "https://new.carta.tech/archive_read_add_passphrase"
---

# archive\_read\_add\_passphrase(3)

functions for reading encrypted archives

## NAME

**archive\_read\_add\_passphrase**, **archive\_read\_set\_passphrase\_callback** - functions for reading encrypted archives

## LIBRARY

Streaming Archive Library (libarchive, -larchive)

## SYNOPSIS

**#include \<archive.h\>**\
 *int*\
 **archive\_read\_add\_passphrase**(*struct archive \**, *const char \*passphrase*);\
 *int*\
 **archive\_read\_set\_passphrase\_callback**(*struct archive \**, *void \*client\_data*, *archive\_passphrase\_callback \**);

## DESCRIPTION

- **archive\_read\_add\_passphrase**()

  Register passphrases for reading an encryption 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\_read\_set\_passphrase\_callback**()

  Register a callback function that will be invoked to get a passphrase  for decryption after trying all the passphrases registered by the **archive\_read\_add\_passphrase**() function failed.

## SEE ALSO

[**tar**(1)](/tar/1.md), [**archive\_read**(3)](/archive_read/3.md), [**archive\_read\_set\_options**(3)](/archive_read_set_options/3.md), [**libarchive**(3)](/libarchive/3.md)
