Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 09ea57f146 | |||
| 0ae2423f19 | |||
| 3859e6492a |
14
otp.c
14
otp.c
@@ -315,9 +315,8 @@ int command_line_mode(int argc, char* argv[]) {
|
|||||||
}
|
}
|
||||||
free(default_pad);
|
free(default_pad);
|
||||||
|
|
||||||
// Call encrypt_text and then comment about using default pad
|
// Call encrypt_text and return result
|
||||||
int result = encrypt_text(pad_identifier, text);
|
return encrypt_text(pad_identifier, text);
|
||||||
return result;
|
|
||||||
} else {
|
} else {
|
||||||
printf("Error: No default pad configured. Specify pad explicitly or configure default pad.\n");
|
printf("Error: No default pad configured. Specify pad explicitly or configure default pad.\n");
|
||||||
return 1;
|
return 1;
|
||||||
@@ -345,8 +344,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 +364,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) {
|
||||||
@@ -1530,7 +1530,7 @@ int encrypt_text(const char* pad_identifier, const char* input_text) {
|
|||||||
if (is_interactive) {
|
if (is_interactive) {
|
||||||
printf("\n\n%s\n\n", ascii_output);
|
printf("\n\n%s\n\n", ascii_output);
|
||||||
} else {
|
} else {
|
||||||
printf("%s", ascii_output);
|
printf("%s\n", ascii_output); // Add newline for proper piping with tee
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
|
|||||||
Reference in New Issue
Block a user