blob: cbaf4f1233f6df2b9a9b150a92382adb6bbd1513 [file] [log] [blame]
Ed Tanous099225c2024-03-27 22:03:05 -07001#include "file_test_utilities.hpp"
2#include "ssl_key_handler.hpp"
3
Ed Tanous41fe81c2024-09-02 15:08:41 -07004#include <string>
5
Ed Tanous099225c2024-03-27 22:03:05 -07006#include <gtest/gtest.h>
7
8namespace ensuressl
9{
10
11TEST(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