Files
sshcrypt/docs/sshcrypt.1
T
lotherk 05b8251333
ci / build (push) Failing after 45s
add the man page, CI, and install it alongside the binary
docs/sshcrypt.1 documents options, environment, exit codes and the security
limits; make lint-man lints it and CI runs that. The Gitea workflow builds,
runs make check, lints the page, then repeats the suite under ASan+UBSan.
make install now writes the man page too.
2026-11-21 16:50:28 +00:00

169 lines
3.5 KiB
Groff

.TH SSHCRYPT 1 "2026-11-21" "sshcrypt 0.1.0" "User Commands"
.SH NAME
sshcrypt \- encrypt a file, a message, or stdin for an SSH public key
.SH SYNOPSIS
.B sshcrypt
.B \-r
.I pubkey
.RB [ \-i
.IR in ]
.RB [ \-o
.IR out ]
.RB [ \-b ]
.RB [ \-q ]
.br
.B sshcrypt
.B \-d \-k
.I privkey
.RB [ \-i
.IR in ]
.RB [ \-o
.IR out ]
.RB [ \-q ]
.br
.B sshcrypt
.B \-F
.I key
.SH DESCRIPTION
.B sshcrypt
encrypts bytes for the holder of an SSH key pair.
Encrypting needs only the recipient's public key, the one already in their
.I authorized_keys
or
.IR id_ed25519.pub .
Decrypting needs the matching private key.
Nothing else is configured, and no identity system is created.
.PP
The ciphertext is ASCII armored by default, so it survives mail, chat and
copy-paste.
With
.B \-b
the raw binary envelope is written instead.
.PP
The default mode is encrypt.
Input is stdin unless
.B \-i
is given; output is stdout unless
.B \-o
is given.
Nothing but the payload is written to stdout.
.SH OPTIONS
.TP
.BR \-e ", " \-\-encrypt
Encrypt.
This is the default.
.TP
.BR \-d ", " \-\-decrypt
Decrypt.
Requires
.BR \-k .
.TP
.BR \-r ", " \-\-recipient " " \fIFILE\fP
The recipient's public key, in
.I authorized_keys
format.
A private key is accepted too: its public half is derived from it.
A file that holds more than one supported key is rejected.
.TP
.BR \-k ", " \-\-key " " \fIFILE\fP
Your private key, for
.BR \-d .
PEM and PKCS#8 keys are read directly.
An OpenSSH-format key
.RB ( "BEGIN OPENSSH PRIVATE KEY" )
is converted through
.BR ssh-keygen (1),
which must then be installed.
.TP
.BR \-i ", " \-\-input " " \fIFILE\fP
Read from
.IR FILE .
The default is stdin;
.B \-
also means stdin.
.TP
.BR \-o ", " \-\-output " " \fIFILE\fP
Write to
.IR FILE .
The default is stdout.
.TP
.BR \-b ", " \-\-binary
Write the raw envelope without the text armor.
.TP
.BR \-q ", " \-\-quiet
Do not print the
\(lqencrypted for\(rq
line on stderr.
That line only appears when stderr is a terminal anyway.
.TP
.BR \-F ", " \-\-fingerprint " " \fIKEY\fP
Print the key's
\(lqSHA256:...\(rq
fingerprint, the same value
.B ssh\-keygen \-l
shows, and exit.
.TP
.BR \-h ", " \-\-help
Print usage and exit.
.TP
.BR \-V ", " \-\-version
Print the version and exit.
.SH ENVIRONMENT
.TP
.B SSHCRYPT_PASSPHRASE
The private key passphrase, for scripts.
Without it the passphrase is read from
.I /dev/tty
with echo off.
It is never read from stdin, which carries the payload.
.TP
.B TMPDIR
Where the temporary key conversion file goes when
.I /dev/shm
is not writable.
.SH FILES
.TP
.I /dev/tty
The passphrase prompt.
.TP
.I /dev/shm/sshcrypt\-XXXXXX
A conversion file, mode 0600, created only for an OpenSSH private key.
It is unlinked as soon as it has been read, and on SIGINT, SIGTERM or SIGHUP.
.SH "EXIT STATUS"
.TP
.B 0
Success.
.TP
.B 1
Usage or I/O error.
.TP
.B 2
Malformed input: not an sshcrypt message, truncated, or bad base64.
.TP
.B 3
Wrong key, or the message was modified.
.SH SECURITY
There are no signatures and no sender authentication:
anyone holding your public key can encrypt to you, and a message proves
nothing about who sent it.
.PP
There is no forward secrecy.
Whoever later obtains the recipient's private key can decrypt the messages
they kept.
.PP
Check fingerprints out of band.
A message names the fingerprint it was addressed to, and
.B sshcrypt
refuses to guess: a mismatch prints both fingerprints.
.PP
Ed25519 and RSA keys are supported.
ECDSA keys are not.
.PP
The whole input is buffered in memory, up to 1 GiB.
.SH "SEE ALSO"
.BR ssh (1),
.BR ssh\-keygen (1),
.BR openssl (1)
.SH LICENSE
CNCL 1.1, the Could Not Care Less License.