Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b619384a1 | |||
| 12b9884572 |
19
otp.c
19
otp.c
@@ -271,7 +271,7 @@ int command_line_mode(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void show_main_menu(void) {
|
void show_main_menu(void) {
|
||||||
printf("=== Main Menu ===\n\n");
|
printf("======================== Main Menu ========================\n");
|
||||||
printf("\033[4mT\033[0mext encrypt\n");
|
printf("\033[4mT\033[0mext encrypt\n");
|
||||||
printf("\033[4mF\033[0mile encrypt\n");
|
printf("\033[4mF\033[0mile encrypt\n");
|
||||||
printf("\033[4mD\033[0mecrypt\n");
|
printf("\033[4mD\033[0mecrypt\n");
|
||||||
@@ -462,18 +462,11 @@ int handle_encrypt_menu(void) {
|
|||||||
int ascii_armor = (atoi(format_input) == 2) ? 1 : 0;
|
int ascii_armor = (atoi(format_input) == 2) ? 1 : 0;
|
||||||
|
|
||||||
// Generate default output filename and use enhanced input function
|
// Generate default output filename and use enhanced input function
|
||||||
char default_output[512];
|
char default_output[1024]; // Increased size to prevent truncation warnings
|
||||||
snprintf(default_output, sizeof(default_output), "%s.decrypted", input_file);
|
if (ascii_armor) {
|
||||||
|
snprintf(default_output, sizeof(default_output), "%s.otp.asc", input_file);
|
||||||
// Remove common encrypted extensions to get a better default
|
} else {
|
||||||
if (strstr(default_output, ".otp.asc.decrypted")) {
|
snprintf(default_output, sizeof(default_output), "%s.otp", input_file);
|
||||||
// Replace .otp.asc.decrypted with original extension or no extension
|
|
||||||
char* ext_pos = strstr(default_output, ".otp.asc.decrypted");
|
|
||||||
*ext_pos = '\0';
|
|
||||||
} else if (strstr(default_output, ".otp.decrypted")) {
|
|
||||||
// Replace .otp.decrypted with original extension or no extension
|
|
||||||
char* ext_pos = strstr(default_output, ".otp.decrypted");
|
|
||||||
*ext_pos = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char output_file[512];
|
char output_file[512];
|
||||||
|
|||||||
1
test_decrypt.txt
Normal file
1
test_decrypt.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Test file content for decryption
|
||||||
BIN
test_decrypt.txt.otp
Normal file
BIN
test_decrypt.txt.otp
Normal file
Binary file not shown.
Reference in New Issue
Block a user