Skip to content
Snippets Groups Projects
Commit de4c7b96 authored by Jérôme Charaoui's avatar Jérôme Charaoui
Browse files

New upstream version 1.3.13

parent cca25e74
No related branches found
No related tags found
No related merge requests found
Showing
with 422 additions and 1286 deletions
......@@ -5,6 +5,37 @@ SPDX-License-Identifier: CC0-1.0
# PGPainless Changelog
## 1.3.13
- Bump `sop-java` to `4.0.7`
## 1.3.12
- Bump `sop-java` to `4.0.5`
- Fix: `sop inline-sign`: Adopt `--as=clearsigned` instead of `--as=cleartextsigned`
- SOP: Hide `Version: PGPainless` armor header in all armored outputs
- Fix: `sop armor`: Do not re-armor already armored data
## 1.3.11
- Fix: When verifying subkey binding signatures with embedded recycled primary
key binding signatures, do not reject signature if primary key binding
predates subkey binding
- SOP `verify`: Forcefully expect `data()` to be non-OpenPGP data
- SOP `sign`: Fix matching of keys and passphrases
- CLI: Added tons of tests \o/
## 1.3.10
- Bump `sop-java` to `4.0.3`
- Fix: Fix NPE when verifying signature made by key without key flags on direct-key signature
## 1.3.9
- Bump `sop-java` to `4.0.2`
- SOP: Improve exception handling
## 1.3.8
- Bump `bcprov` to `1.72`
- Bump `bcpg` to `1.72.1`
- Add `ProducerOptions.setHideArmorHeaders(boolean)` to hide automatically added armor headers
in encrypted messages
## 1.3.7
- Bugfix: Fix signature verification when `DecryptionStream` is drained byte-by-byte using `read()` call
- Add `KeyRingUtils.injectCertification(keys, certification)`
......
......@@ -191,7 +191,7 @@ repositories {
}
dependencies {
implementation 'org.pgpainless:pgpainless-core:1.3.7'
implementation 'org.pgpainless:pgpainless-core:1.3.13'
}
```
......
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-armor
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-ARMOR" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-ARMOR" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,7 @@
pgpainless\-cli\-armor \- Add ASCII Armor to standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli armor\fP [\fB\-\-label\fP=\fI{auto|sig|key|cert|message}\fP]
\fBpgpainless\-cli armor\fP [\fB\-\-stacktrace\fP] [\fB\-\-label\fP=\fI{auto|sig|key|cert|message}\fP]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -40,99 +40,8 @@ pgpainless\-cli\-armor \- Add ASCII Armor to standard input
.RS 4
Label to be used in the header and tail of the armoring
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
\fB\-\-stacktrace\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
Print Stacktrace
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-dearmor
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-DEARMOR" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-DEARMOR" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,102 +31,12 @@
pgpainless\-cli\-dearmor \- Remove ASCII Armor from standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli dearmor\fP
\fBpgpainless\-cli dearmor\fP [\fB\-\-stacktrace\fP]
.SH "DESCRIPTION"
.SH "EXIT CODES:"
.SH "OPTIONS"
.sp
\fB0\fP
\fB\-\-stacktrace\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
Print Stacktrace
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-decrypt
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-DECRYPT" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-DECRYPT" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,7 @@
pgpainless\-cli\-decrypt \- Decrypt a message from standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli decrypt\fP [\fB\-\-not\-after\fP=\fIDATE\fP] [\fB\-\-not\-before\fP=\fIDATE\fP]
\fBpgpainless\-cli decrypt\fP [\fB\-\-stacktrace\fP] [\fB\-\-not\-after\fP=\fIDATE\fP] [\fB\-\-not\-before\fP=\fIDATE\fP]
[\fB\-\-session\-key\-out\fP=\fISESSIONKEY\fP] [\fB\-\-verify\-out\fP=\fIVERIFICATIONS\fP]
[\fB\-\-verify\-with\fP=\fICERT\fP]... [\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP]...
[\fB\-\-with\-password\fP=\fIPASSWORD\fP]... [\fB\-\-with\-session\-key\fP=\fISESSIONKEY\fP]...
......@@ -65,6 +65,11 @@ Defaults to beginning of time (\(aq\-\(aq).
Can be used to learn the session key on successful decryption
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.sp
\fB\-\-verify\-out\fP=\fIVERIFICATIONS\fP
.RS 4
Emits signature verification status to the designated output
......@@ -87,6 +92,8 @@ Is an INDIRECT data type (e.g. file, environment variable, file descriptor...).
Symmetric passphrase to decrypt the message with.
.sp
Enables decryption based on any "SKESK" packets in the "CIPHERTEXT".
.sp
Is an INDIRECT data type (e.g. file, environment variable, file descriptor...)
.RE
.sp
\fB\-\-with\-session\-key\fP=\fISESSIONKEY\fP
......@@ -102,100 +109,4 @@ Is an INDIRECT data type (e.g. file, environment variable, file descriptor...)
[\fIKEY\fP...]
.RS 4
Secret keys to attempt decryption with
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-encrypt
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-ENCRYPT" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-ENCRYPT" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,9 +31,9 @@
pgpainless\-cli\-encrypt \- Encrypt a message from standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli encrypt\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-as\fP=\fI{binary|text}\fP] [\fB\-\-sign\-with\fP=\fIKEY\fP]...
[\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP]... [\fB\-\-with\-password\fP=\fIPASSWORD\fP]...
[\fICERTS\fP...]
\fBpgpainless\-cli encrypt\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-stacktrace\fP] [\fB\-\-as\fP=\fI{binary|text}\fP]
[\fB\-\-sign\-with\fP=\fIKEY\fP]... [\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP]...
[\fB\-\-with\-password\fP=\fIPASSWORD\fP]... [\fICERTS\fP...]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -53,6 +53,11 @@ ASCII armor the output
Sign the output with a private key
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.sp
\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP
.RS 4
Passphrase to unlock the secret key(s).
......@@ -71,100 +76,4 @@ Is an INDIRECT data type (e.g. file, environment variable, file descriptor...)
[\fICERTS\fP...]
.RS 4
Certificates the message gets encrypted to
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-extract-cert
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-EXTRACT\-CERT" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-EXTRACT\-CERT" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,7 @@
pgpainless\-cli\-extract\-cert \- Extract a public key certificate from a secret key from standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli extract\-cert\fP [\fB\-\-[no\-]armor\fP]
\fBpgpainless\-cli extract\-cert\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-stacktrace\fP]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -40,99 +40,8 @@ pgpainless\-cli\-extract\-cert \- Extract a public key certificate from a secret
.RS 4
ASCII armor the output
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
\fB\-\-stacktrace\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
Print Stacktrace
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-generate-completion
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source: generate-completion 4.6.3
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-GENERATE\-COMPLETION" "1" "2022-08-07" "generate\-completion 4.6.3" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-GENERATE\-COMPLETION" "1" "2022-11-06" "generate\-completion 4.6.3" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -28,10 +28,10 @@
. LINKSTYLE blue R < >
.\}
.SH "NAME"
pgpainless\-cli\-generate\-completion \- Generate bash/zsh completion script for pgpainless\-cli.
pgpainless\-cli\-generate\-completion \- Stateless OpenPGP Protocol
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli generate\-completion\fP [\fB\-hV\fP]
\fBpgpainless\-cli generate\-completion\fP [\fB\-hV\fP] [\fB\-\-stacktrace\fP]
.SH "DESCRIPTION"
.sp
Generate bash/zsh completion script for pgpainless\-cli.
......@@ -49,6 +49,11 @@ source <(pgpainless\-cli generate\-completion)
Show this help message and exit.
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Print version information and exit.
......
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-generate-key
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-GENERATE\-KEY" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-GENERATE\-KEY" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,8 @@
pgpainless\-cli\-generate\-key \- Generate a secret key
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli generate\-key\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP] [\fI<userId>\fP...]
\fBpgpainless\-cli generate\-key\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-stacktrace\fP] [\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP]
[\fIUSERID\fP...]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -41,6 +42,11 @@ pgpainless\-cli\-generate\-key \- Generate a secret key
ASCII armor the output
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.sp
\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP
.RS 4
Password to protect the private key with
......@@ -49,104 +55,8 @@ Is an INDIRECT data type (e.g. file, environment variable, file descriptor...).
.RE
.SH "ARGUMENTS"
.sp
[\fI<userId>\fP...]
[\fIUSERID\fP...]
.RS 4
User\-ID, e.g. "Alice <\c
.MTO "alice\(atexample.com" "" ">""
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-help
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-HELP" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-HELP" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -28,10 +28,10 @@
. LINKSTYLE blue R < >
.\}
.SH "NAME"
pgpainless\-cli\-help \- Display usage information for the specified subcommand
pgpainless\-cli\-help \- Stateless OpenPGP Protocol
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli help\fP [\fB\-h\fP] [\fICOMMAND\fP]
\fBpgpainless\-cli help\fP [\fB\-h\fP] [\fB\-\-stacktrace\fP] [\fICOMMAND\fP]
.SH "DESCRIPTION"
.sp
When no COMMAND is given, the usage help for the main command is displayed.
......@@ -42,6 +42,11 @@ If a COMMAND is specified, the help for that command is shown.
.RS 4
Show usage help for the help command and exit.
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.SH "ARGUMENTS"
.sp
[\fICOMMAND\fP]
......
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-inline-detach
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-INLINE\-DETACH" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-INLINE\-DETACH" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,7 @@
pgpainless\-cli\-inline\-detach \- Split signatures from a clearsigned message
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli inline\-detach\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-signatures\-out\fP=\fISIGNATURES\fP]
\fBpgpainless\-cli inline\-detach\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-stacktrace\fP] [\fB\-\-signatures\-out\fP=\fISIGNATURES\fP]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -45,99 +45,8 @@ ASCII armor the output
.RS 4
Destination to which a detached signatures block will be written
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
\fB\-\-stacktrace\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
Print Stacktrace
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-inline-sign
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-INLINE\-SIGN" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-INLINE\-SIGN" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,8 @@
pgpainless\-cli\-inline\-sign \- Create an inline\-signed message from data on standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli inline\-sign\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-as\fP=\fI{binary|text|cleartextsigned}\fP]
\fBpgpainless\-cli inline\-sign\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-stacktrace\fP] [\fB\-\-as\fP=
\fI{binary|text|cleartextsigned}\fP]
[\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP]... [\fIKEYS\fP...]
.SH "DESCRIPTION"
......@@ -55,6 +56,11 @@ If \(aq\-\-as=text\(aq and the input data is not valid UTF\-8, inline\-sign fail
ASCII armor the output
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.sp
\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP
.RS 4
Passphrase to unlock the secret key(s).
......@@ -66,100 +72,4 @@ Is an INDIRECT data type (e.g. file, environment variable, file descriptor...).
[\fIKEYS\fP...]
.RS 4
Secret keys used for signing
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-inline-verify
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-INLINE\-VERIFY" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-INLINE\-VERIFY" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,8 +31,8 @@
pgpainless\-cli\-inline\-verify \- Verify inline\-signed data from standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli inline\-verify\fP [\fB\-\-not\-after\fP=\fIDATE\fP] [\fB\-\-not\-before\fP=\fIDATE\fP]
[\fB\-\-verifications\-out\fP=\fI<verificationsOut>\fP] \fICERT\fP...
\fBpgpainless\-cli inline\-verify\fP [\fB\-\-stacktrace\fP] [\fB\-\-not\-after\fP=\fIDATE\fP] [\fB\-\-not\-before\fP=\fIDATE\fP]
[\fB\-\-verifications\-out\fP=\fI<verificationsOut>\fP] [\fICERT\fP...]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -57,109 +57,18 @@ Reject signatures with a creation date not in range.
Defaults to beginning of time ("\-").
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.sp
\fB\-\-verifications\-out\fP=\fI<verificationsOut>\fP
.RS 4
File to write details over successful verifications to
.RE
.SH "ARGUMENTS"
.sp
\fICERT\fP...
[\fICERT\fP...]
.RS 4
Public key certificates for signature verification
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-sign
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-SIGN" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-SIGN" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,8 +31,8 @@
pgpainless\-cli\-sign \- Create a detached signature on the data from standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli sign\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-as\fP=\fI{binary|text}\fP] [\fB\-\-micalg\-out\fP=\fIMICALG\fP]
[\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP]... [\fIKEYS\fP...]
\fBpgpainless\-cli sign\fP [\fB\-\-[no\-]armor\fP] [\fB\-\-stacktrace\fP] [\fB\-\-as\fP=\fI{binary|text}\fP]
[\fB\-\-micalg\-out\fP=\fIMICALG\fP] [\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP]... [\fIKEYS\fP...]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -42,6 +42,8 @@ pgpainless\-cli\-sign \- Create a detached signature on the data from standard i
Specify the output format of the signed message
.sp
Defaults to \(aqbinary\(aq.
.sp
If \(aq\-\-as=text\(aq and the input data is not valid UTF\-8, sign fails with return code 53.
.RE
.sp
\fB\-\-micalg\-out\fP=\fIMICALG\fP
......@@ -54,6 +56,11 @@ Emits the digest algorithm used to the specified file in a way that can be used
ASCII armor the output
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.sp
\fB\-\-with\-key\-password\fP=\fIPASSWORD\fP
.RS 4
Passphrase to unlock the secret key(s).
......@@ -65,100 +72,4 @@ Is an INDIRECT data type (e.g. file, environment variable, file descriptor...).
[\fIKEYS\fP...]
.RS 4
Secret keys used for signing
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-verify
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-VERIFY" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-VERIFY" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,8 @@
pgpainless\-cli\-verify \- Verify a detached signature over the data from standard input
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli verify\fP [\fB\-\-not\-after\fP=\fIDATE\fP] [\fB\-\-not\-before\fP=\fIDATE\fP] \fISIGNATURE\fP \fICERT\fP...
\fBpgpainless\-cli verify\fP [\fB\-\-stacktrace\fP] [\fB\-\-not\-after\fP=\fIDATE\fP] [\fB\-\-not\-before\fP=\fIDATE\fP] \fISIGNATURE\fP
\fICERT\fP...
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -44,6 +45,11 @@ Reject signatures with a creation date not in range.
.sp
Defaults to beginning of time ("\-").
.RE
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.SH "ARGUMENTS"
.sp
\fISIGNATURE\fP
......@@ -53,101 +59,4 @@ Detached signature
.sp
\fICERT\fP...
.RS 4
Public key certificates for signature verification
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli-version
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI\-VERSION" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI\-VERSION" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,7 +31,7 @@
pgpainless\-cli\-version \- Display version information about the tool
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli version\fP [\fB\-\-extended\fP | \fB\-\-backend\fP]
\fBpgpainless\-cli version\fP [\fB\-\-stacktrace\fP] [\fB\-\-extended\fP | \fB\-\-backend\fP]
.SH "DESCRIPTION"
.SH "OPTIONS"
......@@ -45,99 +45,8 @@ Print information about the cryptographic backend
.RS 4
Print an extended version string
.RE
.SH "EXIT CODES:"
.sp
\fB0\fP
\fB\-\-stacktrace\fP
.RS 4
Successful program execution
.RE
.sp
\fB1\fP
.RS 4
Generic program error
.RE
.sp
\fB3\fP
.RS 4
Verification requested but no verifiable signature found
.RE
.sp
\fB13\fP
.RS 4
Unsupported asymmetric algorithm
.RE
.sp
\fB17\fP
.RS 4
Certificate is not encryption capable
.RE
.sp
\fB19\fP
.RS 4
Usage error: Missing argument
.RE
.sp
\fB23\fP
.RS 4
Incomplete verification instructions
.RE
.sp
\fB29\fP
.RS 4
Unable to decrypt
.RE
.sp
\fB31\fP
.RS 4
Password is not human\-readable
.RE
.sp
\fB37\fP
.RS 4
Unsupported Option
.RE
.sp
\fB41\fP
.RS 4
Invalid data or data of wrong type encountered
.RE
.sp
\fB53\fP
.RS 4
Non\-text input received where text was expected
.RE
.sp
\fB59\fP
.RS 4
Output file already exists
.RE
.sp
\fB61\fP
.RS 4
Input file does not exist
.RE
.sp
\fB67\fP
.RS 4
Cannot unlock password protected secret key
.RE
.sp
\fB69\fP
.RS 4
Unsupported subcommand
.RE
.sp
\fB71\fP
.RS 4
Unsupported special prefix (e.g. "@env/@fd") of indirect parameter
.RE
.sp
\fB73\fP
.RS 4
Ambiguous input (a filename matching the designator already exists)
.RE
.sp
\fB79\fP
.RS 4
Key is not signing capable
Print Stacktrace
.RE
\ No newline at end of file
......@@ -2,12 +2,12 @@
.\" Title: pgpainless-cli
.\" Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.10
.\" Date: 2022-08-07
.\" Date: 2022-11-06
.\" Manual: PGPainless-CLI Manual
.\" Source:
.\" Language: English
.\"
.TH "PGPAINLESS\-CLI" "1" "2022-08-07" "" "PGPainless\-CLI Manual"
.TH "PGPAINLESS\-CLI" "1" "2022-11-06" "" "PGPainless\-CLI Manual"
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.ss \n[.ss] 0
......@@ -31,14 +31,20 @@
pgpainless\-cli \- Stateless OpenPGP Protocol
.SH "SYNOPSIS"
.sp
\fBpgpainless\-cli\fP [COMMAND]
\fBpgpainless\-cli\fP [\fB\-\-stacktrace\fP] [COMMAND]
.SH "DESCRIPTION"
.SH "OPTIONS"
.sp
\fB\-\-stacktrace\fP
.RS 4
Print Stacktrace
.RE
.SH "COMMANDS"
.sp
\fBhelp\fP
.RS 4
Display usage information for the specified subcommand
Stateless OpenPGP Protocol
.RE
.sp
\fBarmor\fP
......@@ -103,7 +109,7 @@ Display version information about the tool
.sp
\fBgenerate\-completion\fP
.RS 4
Generate bash/zsh completion script for pgpainless\-cli.
Stateless OpenPGP Protocol
.RE
.SH "EXIT CODES:"
.sp
......
......@@ -5,87 +5,96 @@
package org.pgpainless.cli.commands;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import com.ginsberg.junit.exit.FailOnSystemExit;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.cli.PGPainlessCLI;
import org.slf4j.LoggerFactory;
import sop.exception.SOPGPException;
public class ArmorCmdTest {
public class ArmorCmdTest extends CLITest {
private static PrintStream originalSout;
@BeforeEach
public void saveSout() {
originalSout = System.out;
public ArmorCmdTest() {
super(LoggerFactory.getLogger(ArmorCmdTest.class));
}
@AfterEach
public void restoreSout() {
System.setOut(originalSout);
}
private static final String key = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" +
"Version: PGPainless\n" +
"Comment: 62E9 DDA4 F20F 8341 D2BC 4B4C 8B07 5177 01F9 534C\n" +
"Comment: alice@pgpainless.org\n" +
"\n" +
"lFgEY2vOkhYJKwYBBAHaRw8BAQdAqGOtLd1tKnuwaYYcdr2/7C0cPiCCggRMKG+W\n" +
"t32QQdEAAP9VaBzjk/AaAqyykZnQHmS1HByEvRLv5/4yJMSr22451BFjtBRhbGlj\n" +
"ZUBwZ3BhaW5sZXNzLm9yZ4iOBBMWCgBBBQJja86SCRCLB1F3AflTTBYhBGLp3aTy\n" +
"D4NB0rxLTIsHUXcB+VNMAp4BApsBBRYCAwEABAsJCAcFFQoJCAsCmQEAACZhAP4s\n" +
"8hn/RBDvyLvGROOd15EYATnWlgyi+b5WXP6cELalJwD1FZy3RROhfNtZWcJPS43f\n" +
"G03pYNyb0NXoitIMAaXEB5xdBGNrzpISCisGAQQBl1UBBQEBB0CqCcYethOynfni\n" +
"8uRO+r/cZWp9hCLy8pRIExKqzcyEFAMBCAcAAP9sRRLoZkLpDaTNNrtIBovXu2AN\n" +
"hL8keUMWtVcuEHnkQA6iiHUEGBYKAB0FAmNrzpICngECmwwFFgIDAQAECwkIBwUV\n" +
"CgkICwAKCRCLB1F3AflTTBVpAP491etrjqCMWx2bBaw3K1vP0Mix6U0vF3J4kP9U\n" +
"eZm6owEA4kX9VAGESvLgIc7CEiswmxdWjxnLQyCRtWXfjgFmYQucWARja86SFgkr\n" +
"BgEEAdpHDwEBB0DBslhDpWC6CV3xJUSo071NSO5Cf4fgOwOj+QHs8mpFbwABAPkQ\n" +
"ioSydYiMi04LyfPohyrhhcdJDHallQg+jYHHUb2pEJCI1QQYFgoAfQUCY2vOkgKe\n" +
"AQKbAgUWAgMBAAQLCQgHBRUKCQgLXyAEGRYKAAYFAmNrzpIACgkQiHlkvEXh+f1e\n" +
"ywEA9A2GLU9LxCJxZf2X4qcZY//YJDChIZHPnY0Vaek1DsMBAN1YILrH2rxQeCXj\n" +
"m4bUKfJIRrGt6ZJscwORgNI1dFQFAAoJEIsHUXcB+VNMK3gA/3vvPm57JsHA860w\n" +
"lB4D1II71oFNL8TFnJqTAvpSKe1AAP49S4mKB4PE0ElcDo7n+nEYt6ba8IMRDlMo\n" +
"rsH85mUgCw==\n" +
"=EMKf\n" +
"-----END PGP PRIVATE KEY BLOCK-----\n";
@Test
@FailOnSystemExit
public void armorSecretKey() throws IOException, PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException {
PGPSecretKeyRing secretKey = PGPainless.generateKeyRing()
.modernKeyRing("alice@pgpainless.org");
byte[] bytes = secretKey.getEncoded();
public void armorSecretKey() throws IOException {
PGPSecretKeyRing secretKeys = PGPainless.readKeyRing().secretKeyRing(key);
byte[] binary = secretKeys.getEncoded();
System.setIn(new ByteArrayInputStream(bytes));
ByteArrayOutputStream armorOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(armorOut));
PGPainlessCLI.execute("armor");
pipeBytesToStdin(binary);
ByteArrayOutputStream armorOut = pipeStdoutToStream();
assertSuccess(executeCommand("armor"));
PGPSecretKeyRing armored = PGPainless.readKeyRing().secretKeyRing(armorOut.toString());
assertArrayEquals(secretKey.getEncoded(), armored.getEncoded());
assertArrayEquals(secretKeys.getEncoded(), armored.getEncoded());
}
@Test
@FailOnSystemExit
public void armorPublicKey() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
PGPSecretKeyRing secretKey = PGPainless.generateKeyRing()
.modernKeyRing("alice@pgpainless.org");
public void armorPublicKey() throws IOException {
PGPSecretKeyRing secretKey = PGPainless.readKeyRing().secretKeyRing(key);
PGPPublicKeyRing publicKey = PGPainless.extractCertificate(secretKey);
byte[] bytes = publicKey.getEncoded();
System.setIn(new ByteArrayInputStream(bytes));
ByteArrayOutputStream armorOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(armorOut));
PGPainlessCLI.execute("armor");
pipeBytesToStdin(bytes);
ByteArrayOutputStream armorOut = pipeStdoutToStream();
assertSuccess(executeCommand("armor"));
PGPPublicKeyRing armored = PGPainless.readKeyRing().publicKeyRing(armorOut.toString());
assertArrayEquals(publicKey.getEncoded(), armored.getEncoded());
}
@Test
@FailOnSystemExit
public void armorMessage() {
public void armorMessage() throws IOException {
String message = "Hello, World!\n";
System.setIn(new ByteArrayInputStream(message.getBytes(StandardCharsets.UTF_8)));
ByteArrayOutputStream armorOut = new ByteArrayOutputStream();
System.setOut(new PrintStream(armorOut));
PGPainlessCLI.execute("armor");
pipeStringToStdin(message);
ByteArrayOutputStream armorOut = pipeStdoutToStream();
assertSuccess(executeCommand("armor"));
String armored = armorOut.toString();
assertTrue(armored.startsWith("-----BEGIN PGP MESSAGE-----\n"));
assertTrue(armored.contains("SGVsbG8sIFdvcmxkIQo="));
}
@Test
public void labelNotYetSupported() throws IOException {
pipeStringToStdin("Hello, World!\n");
ByteArrayOutputStream out = pipeStdoutToStream();
int exitCode = executeCommand("armor", "--label", "Message");
assertEquals(SOPGPException.UnsupportedOption.EXIT_CODE, exitCode);
assertEquals(0, out.size());
}
}
// SPDX-FileCopyrightText: 2022 Paul Schaub <vanitasvitae@fsfe.org>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.cli.commands;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import javax.annotation.Nonnull;
import org.bouncycastle.util.io.Streams;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.opentest4j.TestAbortedException;
import org.pgpainless.cli.TestUtils;
import org.pgpainless.sop.SOPImpl;
import org.slf4j.Logger;
import sop.cli.picocli.SopCLI;
public abstract class CLITest {
protected File testDirectory;
protected InputStream stdin;
protected PrintStream stdout;
protected final Logger LOGGER;
public CLITest(@Nonnull Logger logger) {
LOGGER = logger;
SopCLI.setSopInstance(new SOPImpl());
}
@BeforeEach
public void setup() throws IOException {
testDirectory = TestUtils.createTempDirectory();
testDirectory.deleteOnExit();
LOGGER.debug(testDirectory.getAbsolutePath());
stdin = System.in;
stdout = System.out;
}
@AfterEach
public void cleanup() throws IOException {
resetStreams();
}
public File nonExistentFile(String name) {
File file = new File(testDirectory, name);
if (file.exists()) {
throw new TestAbortedException("File " + file.getAbsolutePath() + " already exists.");
}
return file;
}
public File pipeStdoutToFile(String name) throws IOException {
File file = new File(testDirectory, name);
file.deleteOnExit();
if (!file.createNewFile()) {
throw new TestAbortedException("Cannot create new file " + file.getAbsolutePath());
}
System.setOut(new PrintStream(Files.newOutputStream(file.toPath())));
return file;
}
public ByteArrayOutputStream pipeStdoutToStream() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
pipeStdoutToStream(out);
return out;
}
public void pipeStdoutToStream(OutputStream stream) {
System.setOut(new PrintStream(stream));
}
public void pipeFileToStdin(File file) throws IOException {
System.setIn(Files.newInputStream(file.toPath()));
}
public void pipeBytesToStdin(byte[] bytes) {
System.setIn(new ByteArrayInputStream(bytes));
}
public void pipeStringToStdin(String string) {
System.setIn(new ByteArrayInputStream(string.getBytes(StandardCharsets.UTF_8)));
}
public void resetStdout() {
if (System.out != stdout) {
System.out.flush();
System.out.close();
}
System.setOut(stdout);
}
public void resetStdin() throws IOException {
if (System.in != stdin) {
System.in.close();
}
System.setIn(stdin);
}
public void resetStreams() throws IOException {
resetStdout();
resetStdin();
}
public File writeFile(String name, String data) throws IOException {
return writeFile(name, data.getBytes(StandardCharsets.UTF_8));
}
public File writeFile(String name, byte[] bytes) throws IOException {
return writeFile(name, new ByteArrayInputStream(bytes));
}
public File writeFile(String name, InputStream data) throws IOException {
File file = new File(testDirectory, name);
if (!file.createNewFile()) {
throw new TestAbortedException("Cannot create new file " + file.getAbsolutePath());
}
file.deleteOnExit();
try (FileOutputStream fileOut = new FileOutputStream(file)) {
Streams.pipeAll(data, fileOut);
fileOut.flush();
}
return file;
}
public byte[] readBytesFromFile(File file) {
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
try (FileInputStream fileIn = new FileInputStream(file)) {
Streams.pipeAll(fileIn, buffer);
} catch (FileNotFoundException e) {
throw new TestAbortedException("File " + file.getAbsolutePath() + " does not exist!", e);
} catch (IOException e) {
throw new TestAbortedException("Cannot read from file " + file.getAbsolutePath(), e);
}
return buffer.toByteArray();
}
public String readStringFromFile(File file) {
return new String(readBytesFromFile(file), StandardCharsets.UTF_8);
}
public int executeCommand(String... command) throws IOException {
int exitCode = SopCLI.execute(command);
resetStreams();
return exitCode;
}
public void assertSuccess(int exitCode) {
assertEquals(0, exitCode, "Expected successful program execution");
}
}
......@@ -7,73 +7,73 @@ package org.pgpainless.cli.commands;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.NoSuchAlgorithmException;
import com.ginsberg.junit.exit.FailOnSystemExit;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPSecretKeyRing;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.pgpainless.PGPainless;
import org.pgpainless.cli.PGPainlessCLI;
import org.slf4j.LoggerFactory;
public class DearmorCmdTest {
public class DearmorCmdTest extends CLITest {
private PrintStream originalSout;
@BeforeEach
public void saveSout() {
this.originalSout = System.out;
public DearmorCmdTest() {
super(LoggerFactory.getLogger(DearmorCmdTest.class));
}
@AfterEach
public void restoreSout() {
System.setOut(originalSout);
}
private static final String key = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n" +
"Version: PGPainless\n" +
"Comment: 62E9 DDA4 F20F 8341 D2BC 4B4C 8B07 5177 01F9 534C\n" +
"Comment: alice@pgpainless.org\n" +
"\n" +
"lFgEY2vOkhYJKwYBBAHaRw8BAQdAqGOtLd1tKnuwaYYcdr2/7C0cPiCCggRMKG+W\n" +
"t32QQdEAAP9VaBzjk/AaAqyykZnQHmS1HByEvRLv5/4yJMSr22451BFjtBRhbGlj\n" +
"ZUBwZ3BhaW5sZXNzLm9yZ4iOBBMWCgBBBQJja86SCRCLB1F3AflTTBYhBGLp3aTy\n" +
"D4NB0rxLTIsHUXcB+VNMAp4BApsBBRYCAwEABAsJCAcFFQoJCAsCmQEAACZhAP4s\n" +
"8hn/RBDvyLvGROOd15EYATnWlgyi+b5WXP6cELalJwD1FZy3RROhfNtZWcJPS43f\n" +
"G03pYNyb0NXoitIMAaXEB5xdBGNrzpISCisGAQQBl1UBBQEBB0CqCcYethOynfni\n" +
"8uRO+r/cZWp9hCLy8pRIExKqzcyEFAMBCAcAAP9sRRLoZkLpDaTNNrtIBovXu2AN\n" +
"hL8keUMWtVcuEHnkQA6iiHUEGBYKAB0FAmNrzpICngECmwwFFgIDAQAECwkIBwUV\n" +
"CgkICwAKCRCLB1F3AflTTBVpAP491etrjqCMWx2bBaw3K1vP0Mix6U0vF3J4kP9U\n" +
"eZm6owEA4kX9VAGESvLgIc7CEiswmxdWjxnLQyCRtWXfjgFmYQucWARja86SFgkr\n" +
"BgEEAdpHDwEBB0DBslhDpWC6CV3xJUSo071NSO5Cf4fgOwOj+QHs8mpFbwABAPkQ\n" +
"ioSydYiMi04LyfPohyrhhcdJDHallQg+jYHHUb2pEJCI1QQYFgoAfQUCY2vOkgKe\n" +
"AQKbAgUWAgMBAAQLCQgHBRUKCQgLXyAEGRYKAAYFAmNrzpIACgkQiHlkvEXh+f1e\n" +
"ywEA9A2GLU9LxCJxZf2X4qcZY//YJDChIZHPnY0Vaek1DsMBAN1YILrH2rxQeCXj\n" +
"m4bUKfJIRrGt6ZJscwORgNI1dFQFAAoJEIsHUXcB+VNMK3gA/3vvPm57JsHA860w\n" +
"lB4D1II71oFNL8TFnJqTAvpSKe1AAP49S4mKB4PE0ElcDo7n+nEYt6ba8IMRDlMo\n" +
"rsH85mUgCw==\n" +
"=EMKf\n" +
"-----END PGP PRIVATE KEY BLOCK-----\n";
@Test
@FailOnSystemExit
public void dearmorSecretKey() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
PGPSecretKeyRing secretKey = PGPainless.generateKeyRing()
.modernKeyRing("alice@pgpainless.org");
String armored = PGPainless.asciiArmor(secretKey);
System.setIn(new ByteArrayInputStream(armored.getBytes(StandardCharsets.UTF_8)));
ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));
PGPainlessCLI.execute("dearmor");
assertArrayEquals(secretKey.getEncoded(), out.toByteArray());
public void dearmorSecretKey() throws IOException {
PGPSecretKeyRing secretKey = PGPainless.readKeyRing().secretKeyRing(key);
pipeStringToStdin(key);
ByteArrayOutputStream dearmored = pipeStdoutToStream();
assertSuccess(executeCommand("dearmor"));
assertArrayEquals(secretKey.getEncoded(), dearmored.toByteArray());
}
@Test
@FailOnSystemExit
public void dearmorCertificate() throws PGPException, InvalidAlgorithmParameterException, NoSuchAlgorithmException, IOException {
PGPSecretKeyRing secretKey = PGPainless.generateKeyRing()
.modernKeyRing("alice@pgpainless.org");
public void dearmorCertificate() throws IOException {
PGPSecretKeyRing secretKey = PGPainless.readKeyRing().secretKeyRing(key);
PGPPublicKeyRing certificate = PGPainless.extractCertificate(secretKey);
String armored = PGPainless.asciiArmor(certificate);
String armoredCert = PGPainless.asciiArmor(certificate);
System.setIn(new ByteArrayInputStream(armored.getBytes(StandardCharsets.UTF_8)));
ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));
PGPainlessCLI.execute("dearmor");
pipeStringToStdin(armoredCert);
ByteArrayOutputStream out = pipeStdoutToStream();
assertSuccess(executeCommand("dearmor"));
assertArrayEquals(certificate.getEncoded(), out.toByteArray());
}
@Test
@FailOnSystemExit
public void dearmorMessage() {
public void dearmorMessage() throws IOException {
String armored = "-----BEGIN PGP MESSAGE-----\n" +
"Version: BCPG v1.69\n" +
"\n" +
......@@ -81,10 +81,9 @@ public class DearmorCmdTest {
"=fkLo\n" +
"-----END PGP MESSAGE-----";
System.setIn(new ByteArrayInputStream(armored.getBytes(StandardCharsets.UTF_8)));
ByteArrayOutputStream out = new ByteArrayOutputStream();
System.setOut(new PrintStream(out));
PGPainlessCLI.execute("dearmor");
pipeStringToStdin(armored);
ByteArrayOutputStream out = pipeStdoutToStream();
assertSuccess(executeCommand("dearmor"));
assertEquals("Hello, World\n", out.toString());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment