Compare commits

...

3 Commits

3 changed files with 7 additions and 14 deletions

View File

@@ -1 +0,0 @@
Test file content for decryption

View File

@@ -1,11 +0,0 @@
-----BEGIN OTP MESSAGE-----
Version: v0.2.72
Pad-ChkSum: 97d9d82b5414a9439102f3811fb90ab1d6368a00d33229a18b306476f9d04f82
Pad-Offset: 2873419
iR6J7HHK1Oc6
-----END OTP MESSAGE-----

9
otp.c
View File

@@ -1653,6 +1653,10 @@ int decrypt_text_silent(const char* pad_identifier, const char* encrypted_messag
else if (in_data_section) { else if (in_data_section) {
strncat(base64_data, line_ptr, sizeof(base64_data) - strlen(base64_data) - 1); strncat(base64_data, line_ptr, sizeof(base64_data) - strlen(base64_data) - 1);
} }
else if (strncmp(line_ptr, "Version:", 8) != 0 && strncmp(line_ptr, "Pad-", 4) != 0) {
// This might be base64 data without a blank line separator
strncat(base64_data, line_ptr, sizeof(base64_data) - strlen(base64_data) - 1);
}
} }
line_ptr = strtok(NULL, "\n"); line_ptr = strtok(NULL, "\n");
} }
@@ -1729,8 +1733,9 @@ int decrypt_text_silent(const char* pad_identifier, const char* encrypted_messag
} }
plaintext[ciphertext_len] = '\0'; plaintext[ciphertext_len] = '\0';
// Output only the decrypted text - no extra messages // Output only the decrypted text with newline and flush
printf("%s", plaintext); printf("%s\n", plaintext);
fflush(stdout);
// Cleanup // Cleanup
free(ciphertext); free(ciphertext);