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