---
name: "libalpm_sig"
section: "3"
platform: "linux"
package: "pacman"
version: "7.1.0.r9.g54d9411-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libalpm_sig"
---

# libalpm\_sig(3)

Signature checking - Functions to check signatures

## NAME

libalpm\_sig - Signature checking

 \- Functions to check signatures

## SYNOPSIS

### Data Structures

struct **alpm\_pgpkey\_t**\
 A PGP key.  struct **alpm\_sigresult\_t**\
 Signature result.  struct **alpm\_siglist\_t**\
 Signature list.

### Enumerations

enum **alpm\_siglevel\_t** { **ALPM\_SIG\_PACKAGE** = (1 \<\< 0), **ALPM\_SIG\_PACKAGE\_OPTIONAL** = (1 \<\< 1), **ALPM\_SIG\_PACKAGE\_MARGINAL\_OK** = (1 \<\< 2), **ALPM\_SIG\_PACKAGE\_UNKNOWN\_OK** = (1 \<\< 3), **ALPM\_SIG\_DATABASE** = (1 \<\< 10), **ALPM\_SIG\_DATABASE\_OPTIONAL** = (1 \<\< 11), **ALPM\_SIG\_DATABASE\_MARGINAL\_OK** = (1 \<\< 12), **ALPM\_SIG\_DATABASE\_UNKNOWN\_OK** = (1 \<\< 13), **ALPM\_SIG\_USE\_DEFAULT** = (1 \<\< 30) }\
 PGP signature verification options.  enum **alpm\_sigstatus\_t** { **ALPM\_SIGSTATUS\_VALID**, **ALPM\_SIGSTATUS\_KEY\_EXPIRED**, **ALPM\_SIGSTATUS\_SIG\_EXPIRED**, **ALPM\_SIGSTATUS\_KEY\_UNKNOWN**, **ALPM\_SIGSTATUS\_KEY\_DISABLED**, **ALPM\_SIGSTATUS\_INVALID** }\
 PGP signature verification status return codes.  enum **alpm\_sigvalidity\_t** { **ALPM\_SIGVALIDITY\_FULL**, **ALPM\_SIGVALIDITY\_MARGINAL**, **ALPM\_SIGVALIDITY\_NEVER**, **ALPM\_SIGVALIDITY\_UNKNOWN** }\
 The trust level of a PGP key.

### Functions

int **alpm\_pkg\_check\_pgp\_signature** (**alpm\_pkg\_t** \*pkg, **alpm\_siglist\_t** \*siglist)\
 Check the PGP signature for the given package file.  int **alpm\_db\_check\_pgp\_signature** (**alpm\_db\_t** \*db, **alpm\_siglist\_t** \*siglist)\
 Check the PGP signature for the given database.  int **alpm\_siglist\_cleanup** (**alpm\_siglist\_t** \*siglist)\
 Clean up and free a signature result list.  int **alpm\_decode\_signature** (const char \*base64\_data, unsigned char \*\*data, size\_t \*data\_len)\
 Decode a loaded signature in base64 form.  int **alpm\_extract\_keyid** (**alpm\_handle\_t** \*handle, const char \*identifier, const unsigned char \*sig, const size\_t len, **alpm\_list\_t** \*\*keys)\
 Extract the Issuer Key ID from a signature.

## Detailed Description

Functions to check signatures

## Data Structure Documentation

## struct alpm\_pgpkey\_t

A PGP key.

**Data Fields:**

**alpm\_time\_t** *created* When the key was created. \

void \* *data* The actual key data. \

char \* *email* Email of the key's owner. \

**alpm\_time\_t** *expires* When the key expires. \

char \* *fingerprint* The key's fingerprint. \

unsigned int *length* The length of the key. \

char \* *name* Name of the key's owner. \

unsigned int *revoked* has the key been revoked \

char \* *uid* UID of the key. \

## struct alpm\_sigresult\_t

Signature result.

Contains the key, status, and validity of a given signature.

**Data Fields:**

**alpm\_pgpkey\_t** *key* The key of the signature. \

**alpm\_sigstatus\_t** *status* The status of the signature. \

**alpm\_sigvalidity\_t** *validity* The validity of the signature. \

## struct alpm\_siglist\_t

Signature list.

Contains the number of signatures found and a pointer to an array of results. The array is of size count.

**Data Fields:**

size\_t *count* The amount of results in the array. \

**alpm\_sigresult\_t** \* *results* An array of sigresults. \

## Enumeration Type Documentation

### enum alpm\_siglevel\_t

PGP signature verification options.

**Enumerator**

- ***ALPM\_SIG\_PACKAGE***

  Packages require a signature.

- ***ALPM\_SIG\_PACKAGE\_OPTIONAL***

  Packages do not require a signature, but check packages that do have signatures.

- ***ALPM\_SIG\_PACKAGE\_UNKNOWN\_OK***

  Allow packages with signatures that are unknown trust.

- ***ALPM\_SIG\_DATABASE***

  Databases require a signature.

- ***ALPM\_SIG\_DATABASE\_OPTIONAL***

  Databases do not require a signature, but check databases that do have signatures.

- ***ALPM\_SIG\_DATABASE\_MARGINAL\_OK***

  Allow databases with signatures that are marginal trust.

- ***ALPM\_SIG\_DATABASE\_UNKNOWN\_OK***

  Allow databases with signatures that are unknown trust.

- ***ALPM\_SIG\_USE\_DEFAULT***

  The Default siglevel.

### enum alpm\_sigstatus\_t

PGP signature verification status return codes.

**Enumerator**

- ***ALPM\_SIGSTATUS\_VALID***

  Signature is valid.

- ***ALPM\_SIGSTATUS\_KEY\_EXPIRED***

  The key has expired.

- ***ALPM\_SIGSTATUS\_SIG\_EXPIRED***

  The signature has expired.

- ***ALPM\_SIGSTATUS\_KEY\_UNKNOWN***

  The key is not in the keyring.

- ***ALPM\_SIGSTATUS\_KEY\_DISABLED***

  The key has been disabled.

- ***ALPM\_SIGSTATUS\_INVALID***

  The signature is invalid.

### enum alpm\_sigvalidity\_t

The trust level of a PGP key.

**Enumerator**

- ***ALPM\_SIGVALIDITY\_FULL***

  The signature is fully trusted.

- ***ALPM\_SIGVALIDITY\_MARGINAL***

  The signature is marginally trusted.

- ***ALPM\_SIGVALIDITY\_NEVER***

  The signature is never trusted.

- ***ALPM\_SIGVALIDITY\_UNKNOWN***

  The signature has unknown trust.

## Function Documentation

### int alpm\_db\_check\_pgp\_signature (alpm\_db\_t \* db, alpm\_siglist\_t \* siglist)

Check the PGP signature for the given database.

**Parameters**

*db* the database to check \
 *siglist* a pointer to storage for signature results

**Returns**

0 on success, -1 if an error occurred or signature is missing

References **alpm\_db\_check\_pgp\_signature()**.

Referenced by **alpm\_db\_check\_pgp\_signature()**.

### int alpm\_decode\_signature (const char \* base64\_data, unsigned char \*\* data, size\_t \* data\_len)

Decode a loaded signature in base64 form.

**Parameters**

*base64\_data* the signature to attempt to decode \
 *data* the decoded data; must be freed by the caller \
 *data\_len* the length of the returned data

**Returns**

0 on success, -1 on failure to properly decode

References **alpm\_decode\_signature()**.

Referenced by **alpm\_decode\_signature()**.

### int alpm\_extract\_keyid (alpm\_handle\_t \* handle, const char \* identifier, const unsigned char \* sig, const size\_t len, alpm\_list\_t \*\* keys)

Extract the Issuer Key ID from a signature.

**Parameters**

*handle* the context handle \
 *identifier* the identifier of the key. This may be the name of the package or the path to the package. \
 *sig* PGP signature \
 *len* length of signature \
 *keys* a pointer to storage for key IDs

**Returns**

0 on success, -1 on error

References **alpm\_extract\_keyid()**.

Referenced by **alpm\_extract\_keyid()**.

### int alpm\_pkg\_check\_pgp\_signature (alpm\_pkg\_t \* pkg, alpm\_siglist\_t \* siglist)

Check the PGP signature for the given package file.

**Parameters**

*pkg* the package to check \
 *siglist* a pointer to storage for signature results

**Returns**

0 on success, -1 if an error occurred or signature is missing

References **alpm\_pkg\_check\_pgp\_signature()**.

Referenced by **alpm\_pkg\_check\_pgp\_signature()**.

### int alpm\_siglist\_cleanup (alpm\_siglist\_t \* siglist)

Clean up and free a signature result list. Note that this does not free the siglist object itself in case that was allocated on the stack; this is the responsibility of the caller.

**Parameters**

*siglist* a pointer to storage for signature results

**Returns**

0 on success, -1 on error

References **alpm\_siglist\_cleanup()**.

Referenced by **alpm\_siglist\_cleanup()**.

## Author

Generated automatically by Doxygen for libalpm from the source code.
