Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3859e6492a | |||
| 0978d0323a |
15
otp.c
15
otp.c
@@ -345,8 +345,8 @@ int command_line_mode(int argc, char* argv[]) {
|
|||||||
else if (argc == 3) {
|
else if (argc == 3) {
|
||||||
// Check if the argument looks like an encrypted message (starts with -----)
|
// Check if the argument looks like an encrypted message (starts with -----)
|
||||||
if (strncmp(argv[2], "-----BEGIN OTP MESSAGE-----", 27) == 0) {
|
if (strncmp(argv[2], "-----BEGIN OTP MESSAGE-----", 27) == 0) {
|
||||||
// Inline decrypt with message only
|
// Inline decrypt with message only - use silent mode for command line
|
||||||
return decrypt_text(NULL, argv[2]);
|
return decrypt_text_silent(NULL, argv[2]);
|
||||||
} else {
|
} else {
|
||||||
// Check if it's a file (contains . or ends with known extensions)
|
// Check if it's a file (contains . or ends with known extensions)
|
||||||
if (strstr(argv[2], ".") != NULL) {
|
if (strstr(argv[2], ".") != NULL) {
|
||||||
@@ -365,7 +365,8 @@ int command_line_mode(int argc, char* argv[]) {
|
|||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
// Legacy format: pad_chksum and message, or file with output
|
// Legacy format: pad_chksum and message, or file with output
|
||||||
return decrypt_text(argv[2], argv[3]);
|
// Use silent mode for command line when message is provided
|
||||||
|
return decrypt_text_silent(argv[2], argv[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (argc == 5 && strcmp(argv[3], "-o") == 0) {
|
else if (argc == 5 && strcmp(argv[3], "-o") == 0) {
|
||||||
@@ -2907,6 +2908,7 @@ int universal_decrypt(const char* input_data, const char* output_target, decrypt
|
|||||||
if (mode == DECRYPT_MODE_FILE_TO_TEXT) {
|
if (mode == DECRYPT_MODE_FILE_TO_TEXT) {
|
||||||
printf("Decrypting ASCII armored file...\n");
|
printf("Decrypting ASCII armored file...\n");
|
||||||
}
|
}
|
||||||
|
// Note: DECRYPT_MODE_FILE_TO_FILE should be completely silent for piping
|
||||||
} else {
|
} else {
|
||||||
// Text input (interactive or piped)
|
// Text input (interactive or piped)
|
||||||
const char* message_text;
|
const char* message_text;
|
||||||
@@ -3063,8 +3065,11 @@ int universal_decrypt(const char* input_data, const char* output_target, decrypt
|
|||||||
}
|
}
|
||||||
fclose(output_fp);
|
fclose(output_fp);
|
||||||
|
|
||||||
printf("File decrypted successfully: %s\n", output_file);
|
// Only show success messages in non-silent modes
|
||||||
printf("Note: ASCII format does not preserve original filename/permissions\n");
|
if (mode != DECRYPT_MODE_FILE_TO_FILE) {
|
||||||
|
printf("File decrypted successfully: %s\n", output_file);
|
||||||
|
printf("Note: ASCII format does not preserve original filename/permissions\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Text output to stdout
|
// Text output to stdout
|
||||||
ciphertext[ciphertext_len] = '\0';
|
ciphertext[ciphertext_len] = '\0';
|
||||||
|
|||||||
Reference in New Issue
Block a user