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