SOP encrypt: match signature type when using --as= option

This commit is contained in:
Paul Schaub 2022-03-30 12:49:26 +02:00
parent 30a62daec9
commit 4782868bc1
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 5 additions and 1 deletions

View File

@ -60,7 +60,11 @@ public class EncryptImpl implements Encrypt {
signingOptions = SigningOptions.get();
}
try {
signingOptions.addInlineSignatures(SecretKeyRingProtector.unprotectedKeys(), keys, DocumentSignatureType.BINARY_DOCUMENT);
signingOptions.addInlineSignatures(
SecretKeyRingProtector.unprotectedKeys(),
keys,
(encryptAs == EncryptAs.Binary ? DocumentSignatureType.BINARY_DOCUMENT : DocumentSignatureType.CANONICAL_TEXT_DOCUMENT)
);
} catch (IllegalArgumentException e) {
throw new SOPGPException.KeyCannotSign();
} catch (WrongPassphraseException e) {