MCPcopy Create free account
hub / github.com/Icinga/icinga2 / FormatAsn1Time

Function FormatAsn1Time

test/base-tlsutility.cpp:110–119  ·  view source on GitHub ↗

* Formats an ASN1_TIME object as a human-readable string. * * @param t The ASN1_TIME object to format. * * @returns A string representation of the ASN1_TIME object. */

Source from the content-addressed store, hash-verified

108 * @returns A string representation of the ASN1_TIME object.
109 */
110static std::string FormatAsn1Time(const ASN1_TIME* t)
111{
112 std::shared_ptr<BIO> bio(BIO_new(BIO_s_mem()), BIO_free);
113 BOOST_REQUIRE_MESSAGE(bio, "BIO_new(BIO_s_mem()): " << GetOpenSSLError());
114 ASN1_TIME_print(bio.get(), t);
115 char *data;
116 long len = BIO_get_mem_data(bio.get(), &data);
117 std::string result(data, data + len);
118 return result;
119}
120
121// Asserts that verifying the given leaf certificate against the given CA certificate results in a certificate
122// expiration error. This macro is used so that when the assertion fails, the test output refers to the exact

Callers 1

Calls 2

GetOpenSSLErrorFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected