// This contains a private key that, at the time of writing, matches the DKIM public key for dev.citadel.org
// We can use the attached test message to validate a signature against that.
-#include <stdlib.h>
-#include <unistd.h>
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <time.h>
-#include <assert.h>
#include <syslog.h>
#include <libcitadel.h>
-// oof, a prototype where one does not belong hehe
+// This was easier than trying to figure out the header situation
void dkim_sign(StrBuf *email, char *pkey_in, char *domain, char *selector);
int main(int argc, char *argv[]) {
+ // display the greeting
+ fprintf(stderr,
+ "\033[44m\033[1m╔════════════════════════════════════════════════════════════════════════╗\033[0m\n"
+ "\033[44m\033[1m║ DKIM signature test program for Citadel ║\033[0m\n"
+ "\033[44m\033[1m║ Copyright (c) 2024 by citadel.org et al. ║\033[0m\n"
+ "\033[44m\033[1m║ This program is open source software. Use, duplication, or disclosure ║\033[0m\n"
+ "\033[44m\033[1m║ is subject to the terms of the GNU General Public license v3. ║\033[0m\n"
+ "\033[44m\033[1m╚════════════════════════════════════════════════════════════════════════╝\033[0m\n"
+ );
+
openlog("dkim", LOG_PERROR, LOG_USER);
char *private_key =
"-----END PRIVATE KEY-----\n"
;
- // These elements are identical to the ones from previous revisions. Don't change them; we need to compare.
char *domain = "dev.citadel.org";
char *selector = "foo";
FILE *fp;
printf("\033[34m-----\033[0m\n");
- printf("Piping original version to test program...\n");
+ printf("Piping original version to test program (this should pass)\n");
fp = popen("./tester.pl | sed s/pass/\033[32mpass\033[0m/g | sed s/fail/\033[31mfail\033[0m/g", "w");
fwrite((char *)ChrPtr(email), StrLength(email), 1, fp);
pclose(fp);
printf("\033[34m-----\033[0m\n");
- printf("Piping altered version to test program...\n");
+ printf("Piping altered version to test program (this should fail)\n");
fp = popen("sed s/oggs/argh/g | ./tester.pl | sed s/pass/\033[32mpass\033[0m/g | sed s/fail/\033[31mfail\033[0m/g", "w");
fwrite((char *)ChrPtr(email), StrLength(email), 1, fp);
pclose(fp);