LinuxCommandLibrary

gpgsplit

Split OpenPGP messages into smaller parts

SYNOPSIS

gpgsplit [options] [file]

PARAMETERS

-?, --help
    Print a brief usage summary.

--output-prefix string
    Set prefix for output files (default: input name + ".gpgsplit" or "gpgsplit"). Must not end in a period.

--multifile
    Split even single-message files into numbered parts.

--yes
    Assume "yes" to all prompts.

--verbose, -v
    Enable detailed output.

--quiet
    Suppress all output except errors.

--no-tty
    Never prompt or use TTY.

--version
    Display version information.

DESCRIPTION

gpgsplit is a GnuPG utility for splitting a file containing multiple concatenated OpenPGP messages into individual files. It parses the input, identifies complete message boundaries, and extracts each message to a separate output file named PREFIX.1, PREFIX.2, etc.

This is invaluable for handling email archives, logs, or downloads where multiple signed, encrypted, or signed-and-encrypted OpenPGP messages are stored sequentially in one file. Without splitting, processing requires manual extraction or complex scripting. gpgsplit automates this, preserving message integrity for subsequent operations like verification with gpg --verify or decryption.

Input can come from a file or stdin. By default, the prefix derives from the input filename by appending ".gpgsplit" (or "gpgsplit" for stdin). It supports both ASCII-armored and binary formats, outputting files in the original format. The tool reports the number of parts created to stderr.

Key benefits include simplifying batch processing, complying with size limits in email or storage, and enabling parallel handling of messages. It requires complete messages; partial or malformed ones cause errors.

CAVEATS

Requires complete OpenPGP messages; fails on partial or corrupted data. Does not split single large messages into smaller chunks—only separates concatenated ones. Output overwrites existing files without warning unless --yes is avoided.

EXAMPLE

gpgsplit messages.asc
Creates messages.asc.gpgsplit.1, messages.asc.gpgsplit.2, etc.

gpgsplit --output-prefix parts - < messages.asc
Reads stdin, outputs parts.1, parts.2, etc.

OUTPUT NAMING

Files numbered sequentially starting from .1. Number of parts printed to stderr.

HISTORY

Introduced in GnuPG 1.0 (1998) by the GnuPG Project for handling multi-message files. Enhanced in GnuPG 2.x with --multifile and better prefix handling. Widely used in email processing workflows.

SEE ALSO

gpg(1), gpgv(1), split(1)

Copied to clipboard