Ed Tanous | 099225c | 2024-03-27 22:03:05 -0700 | [diff] [blame] | 1 | #include "file_test_utilities.hpp" |
| 2 | #include "ssl_key_handler.hpp" |
| 3 | |
Ed Tanous | 41fe81c | 2024-09-02 15:08:41 -0700 | [diff] [blame] | 4 | #include <string> |
| 5 | |
Ed Tanous | 099225c | 2024-03-27 22:03:05 -0700 | [diff] [blame] | 6 | #include <gtest/gtest.h> |
| 7 | |
| 8 | namespace ensuressl |
| 9 | { |
| 10 | |
| 11 | TEST(SSLKeyHandler, GenerateVerifyRoundTrip) |
| 12 | { |
| 13 | /* Verifies that we can generate a certificate, then read back in the |
| 14 | * certificate that was read */ |
| 15 | TemporaryFileHandle myFile(""); |
| 16 | std::string cert = generateSslCertificate("TestCommonName"); |
| 17 | |
| 18 | EXPECT_FALSE(cert.empty()); |
| 19 | |
| 20 | writeCertificateToFile(myFile.stringPath, cert); |
| 21 | |
| 22 | std::string cert2 = verifyOpensslKeyCert(myFile.stringPath); |
| 23 | EXPECT_FALSE(cert2.empty()); |
| 24 | EXPECT_EQ(cert, cert2); |
| 25 | } |
| 26 | |
| 27 | } // namespace ensuressl |