1 // SPDX-License-Identifier: Apache-2.0 2 // SPDX-FileCopyrightText: Copyright OpenBMC Authors 3 #include "file_test_utilities.hpp" 4 #include "ssl_key_handler.hpp" 5 6 #include <string> 7 8 #include <gtest/gtest.h> 9 10 namespace ensuressl 11 { 12 TEST(SSLKeyHandler,GenerateVerifyRoundTrip)13TEST(SSLKeyHandler, GenerateVerifyRoundTrip) 14 { 15 /* Verifies that we can generate a certificate, then read back in the 16 * certificate that was read */ 17 TemporaryFileHandle myFile(""); 18 std::string cert = generateSslCertificate("TestCommonName"); 19 20 EXPECT_FALSE(cert.empty()); 21 22 writeCertificateToFile(myFile.stringPath, cert); 23 24 std::string cert2 = verifyOpensslKeyCert(myFile.stringPath); 25 EXPECT_FALSE(cert2.empty()); 26 EXPECT_EQ(cert, cert2); 27 } 28 29 } // namespace ensuressl 30