8 #include <security/security.h>
10 #define SECURITY_TEST_DATA_DIR TEST_LIB_DATA_BASE "/security/"
11 #define SECURITY_TEST_DATA_CERT SECURITY_TEST_DATA_DIR "/cert.pem"
19 /* start with basic pubkey extraction */
20 keyfile = fopen(SECURITY_TEST_DATA_DIR "cert.pem", "r");
24 /* first basic verify case */
25 /* assuming the default sha256 mode */
27 if (verify_file_signature(SECURITY_TEST_DATA_DIR "rootdata.txt",
28 SECURITY_TEST_DATA_DIR "rootdatasha256.sig",
36 /* now check different file */
38 if (!verify_file_signature(SECURITY_TEST_DATA_DIR "rootdata_different.txt",
39 SECURITY_TEST_DATA_DIR "rootdatasha256.sig",
47 /* now check different signature */
49 if (!verify_file_signature(SECURITY_TEST_DATA_DIR "rootdata.txt",
50 SECURITY_TEST_DATA_DIR "rootdatasha512.sig",
58 /* check CMS verify */
59 if (verify_file_signature(SECURITY_TEST_DATA_DIR "rootdata.txt",
60 SECURITY_TEST_DATA_DIR "rootdata.cmsver",
70 /* now check basic pubkey fallback */
71 keyfile = fopen(SECURITY_TEST_DATA_DIR "pubkey.pem", "r");
75 if (verify_file_signature(SECURITY_TEST_DATA_DIR "rootdata.txt",
76 SECURITY_TEST_DATA_DIR "rootdatasha256.sig",
86 /* finally check different key */
87 keyfile = fopen(SECURITY_TEST_DATA_DIR "wrong_cert.pem", "r");
91 if (!verify_file_signature(SECURITY_TEST_DATA_DIR "rootdata.txt",
92 SECURITY_TEST_DATA_DIR "rootdatasha256.sig",