3 #include <boost/test/unit_test.hpp>
8 BOOST_AUTO_TEST_SUITE( TestX509Req )
10 BOOST_AUTO_TEST_CASE( CSR ) {
11 // Testing a valid CSR
12 std::shared_ptr<X509Req> req( X509Req::parseCSR( readFile( "testdata/test.csr" ) ) );
14 BOOST_CHECK( req->verify() == 1 );
16 // Testing a CSR, where the signature content has been tampered with
17 req = std::shared_ptr<X509Req>( X509Req::parseCSR( readFile( "testdata/test_false_sig.csr" ) ) );
19 BOOST_CHECK( req->verify() == 0 );
21 // Testing a CSR, where the signature OID is something strange
22 req = std::shared_ptr<X509Req>( X509Req::parseCSR( readFile( "testdata/test_invalid_sig.csr" ) ) );
24 BOOST_CHECK( req->verify() < 0 );
27 BOOST_AUTO_TEST_CASE( SPKAC ) {
28 // Testing a valid SPKAC
29 std::shared_ptr<X509Req> req( X509Req::parseSPKAC( readFile( "testdata/test.spkac" ) ) );
31 BOOST_CHECK( req->verify() == 1 );
33 // Testing a SPKAC, where the signature content has been tampered with
34 req = std::shared_ptr<X509Req>( X509Req::parseSPKAC( readFile( "testdata/test_false_sig.spkac" ) ) );
36 BOOST_CHECK( req->verify() == 0 );
38 // Testing a SPKAC, where the signature OID is something strange
39 req = std::shared_ptr<X509Req>( X509Req::parseSPKAC( readFile( "testdata/test_invalid_sig.spkac" ) ) );
41 BOOST_CHECK( req->verify() < 0 );
44 BOOST_AUTO_TEST_SUITE_END()