bool TestExtOpenssl::test_openssl_x509_parse() { Variant fcert = f_file_get_contents("test/test_x509.crt"); Variant cert = f_openssl_x509_read(fcert); Variant info = f_openssl_x509_parse(cert); VS(info[s_subject][s_O], "RSA Data Security, Inc."); return Count(true); }
bool TestExtOpenssl::test_openssl_x509_checkpurpose() { Variant fcert = f_file_get_contents("test/test_x509.crt"); Variant cert = f_openssl_x509_read(fcert); VS(f_openssl_x509_checkpurpose(cert, k_X509_PURPOSE_SSL_CLIENT), 0); VS(f_openssl_x509_checkpurpose(cert, k_X509_PURPOSE_SSL_SERVER), 0); return Count(true); }
bool TestExtOpenssl::test_openssl_x509_free() { Variant fcert = f_file_get_contents("test/test_x509.crt"); Variant cert = f_openssl_x509_read(fcert); VERIFY(!cert.toObject().isNull()); f_openssl_x509_free(cert); return Count(true); }
bool TestExtOpenssl::test_openssl_x509_export_to_file() { Variant fcert = f_file_get_contents("test/test_x509.crt"); Variant cert = f_openssl_x509_read(fcert); const char *tmp = "test/test_x509.tmp"; f_unlink(tmp); VS(f_file_get_contents(tmp), false); VERIFY(f_openssl_x509_export_to_file(cert, tmp)); Variant fcert2 = f_file_get_contents(tmp); Variant cert2 = f_openssl_x509_read(fcert2); Variant info = f_openssl_x509_parse(cert2); VS(info["subject"]["O"], "RSA Data Security, Inc."); f_unlink(tmp); return Count(true); }