| 169 | | |
|---|
| 170 | | #ifdef TODO |
|---|
| 171 | | snprintf(cmd,MAXBUF,"gpg --quiet --no-tty --openpgp --encrypt --personal-cipher-preferences='CAST5' --armor --homedir=%s --recipient Alpha %s/%s", dir, dir, filename_rsa_armour_nopassphrase); |
|---|
| 172 | | if (system(cmd)) |
|---|
| 173 | | { |
|---|
| 174 | | return 1; |
|---|
| 175 | | } |
|---|
| 176 | | |
|---|
| 177 | | snprintf(cmd,MAXBUF,"gpg --quiet --no-tty --openpgp --encrypt --s2k-cipher-algo CAST5 --homedir=%s --recipient Bravo %s/%s", dir, dir, filename_rsa_noarmour_passphrase); |
|---|
| 178 | | if (system(cmd)) |
|---|
| 179 | | { |
|---|
| 180 | | return 1; |
|---|
| 181 | | } |
|---|
| 182 | | |
|---|
| 183 | | snprintf(cmd,MAXBUF,"gpg --quiet --no-tty --openpgp --encrypt --s2k-cipher-algo CAST5 --armor --homedir=%s --recipient Bravo %s/%s", dir, dir, filename_rsa_armour_passphrase); |
|---|
| 184 | | if (system(cmd)) |
|---|
| 185 | | { |
|---|
| 186 | | return 1; |
|---|
| 187 | | } |
|---|
| 188 | | #endif |
|---|
| 189 | | |
|---|
| | 169 | // Armour, no passphrase |
|---|
| | 170 | snprintf(cmd,sizeof cmd,"gpg --quiet --no-tty --homedir=%s --force-mdc --compress-level 0 --personal-cipher-preferences='CAST5' --encrypt --armor --recipient Alpha %s/%s", dir, dir, filename_rsa_armour_nopassphrase); |
|---|
| | 171 | if (system(cmd)) |
|---|
| | 172 | { |
|---|
| | 173 | return 1; |
|---|
| | 174 | } |
|---|
| | 175 | |
|---|
| | 176 | // No armour, passphrase |
|---|
| | 177 | snprintf(cmd,sizeof cmd,"gpg --quiet --no-tty --homedir=%s --force-mdc --compress-level 0 --personal-cipher-preferences='CAST5' --encrypt --recipient Bravo %s/%s", dir, dir, filename_rsa_noarmour_passphrase); |
|---|
| | 178 | if (system(cmd)) |
|---|
| | 179 | { |
|---|
| | 180 | return 1; |
|---|
| | 181 | } |
|---|
| | 182 | |
|---|
| | 183 | // Armour, passphrase |
|---|
| | 184 | snprintf(cmd,sizeof cmd,"gpg --quiet --no-tty --homedir=%s --force-mdc --compress-level 0 --personal-cipher-preferences='CAST5' --encrypt --armor --recipient Bravo %s/%s", dir, dir, filename_rsa_armour_passphrase); |
|---|
| | 185 | if (system(cmd)) |
|---|
| | 186 | { |
|---|
| | 187 | return 1; |
|---|
| | 188 | } |
|---|
| | 189 | |
|---|
| | 339 | static int add_tests(CU_pSuite suite) |
|---|
| | 340 | { |
|---|
| | 341 | // add tests to suite |
|---|
| | 342 | |
|---|
| | 343 | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (Default)", test_rsa_decrypt_noarmour_nopassphrase)) |
|---|
| | 344 | return 0; |
|---|
| | 345 | |
|---|
| | 346 | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (CAST5)", test_rsa_decrypt_noarmour_nopassphrase_cast5)) |
|---|
| | 347 | return 0; |
|---|
| | 348 | |
|---|
| | 349 | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (AES128)", test_rsa_decrypt_noarmour_nopassphrase_aes128)) |
|---|
| | 350 | return 0; |
|---|
| | 351 | |
|---|
| | 352 | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (AES256)", test_rsa_decrypt_noarmour_nopassphrase_aes256)) |
|---|
| | 353 | return 0; |
|---|
| | 354 | |
|---|
| | 355 | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (3DES)", test_rsa_decrypt_noarmour_nopassphrase_3des)) |
|---|
| | 356 | return 0; |
|---|
| | 357 | |
|---|
| | 358 | if (NULL == CU_add_test(suite, "Unarmoured, passphrase", test_rsa_decrypt_noarmour_passphrase)) |
|---|
| | 359 | return 0; |
|---|
| | 360 | |
|---|
| | 361 | if (NULL == CU_add_test(suite, "Armoured, no passphrase", test_rsa_decrypt_armour_nopassphrase)) |
|---|
| | 362 | return 0; |
|---|
| | 363 | |
|---|
| | 364 | if (NULL == CU_add_test(suite, "Armoured, passphrase", test_rsa_decrypt_armour_passphrase)) |
|---|
| | 365 | return 0; |
|---|
| | 366 | |
|---|
| | 367 | if (NULL == CU_add_test(suite, "Tests to be implemented", test_todo)) |
|---|
| | 368 | return 0; |
|---|
| | 369 | |
|---|
| | 370 | return 1; |
|---|
| | 371 | } |
|---|
| | 372 | |
|---|
| 350 | | // add tests to suite |
|---|
| 351 | | |
|---|
| 352 | | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (Default)", test_rsa_decrypt_noarmour_nopassphrase)) |
|---|
| 353 | | return NULL; |
|---|
| 354 | | |
|---|
| 355 | | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (CAST5)", test_rsa_decrypt_noarmour_nopassphrase_cast5)) |
|---|
| 356 | | return NULL; |
|---|
| 357 | | |
|---|
| 358 | | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (AES128)", test_rsa_decrypt_noarmour_nopassphrase_aes128)) |
|---|
| 359 | | return NULL; |
|---|
| 360 | | |
|---|
| 361 | | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (AES256)", test_rsa_decrypt_noarmour_nopassphrase_aes256)) |
|---|
| 362 | | return NULL; |
|---|
| 363 | | |
|---|
| 364 | | if (NULL == CU_add_test(suite, "Unarmoured, no passphrase (3DES)", test_rsa_decrypt_noarmour_nopassphrase_3des)) |
|---|
| 365 | | return NULL; |
|---|
| 366 | | |
|---|
| 367 | | if (NULL == CU_add_test(suite, "Tests to be implemented", test_todo)) |
|---|
| 368 | | return NULL; |
|---|
| 369 | | |
|---|
| | 381 | if (!add_tests(suite)) |
|---|
| | 382 | return NULL; |
|---|
| | 383 | |
|---|