diff options
Diffstat (limited to 'unotest/source/cpp')
-rw-r--r-- | unotest/source/cpp/macros_test.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index 718c0b1b8954..81738dc6dafe 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -15,6 +15,7 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/DispatchHelper.hpp> #include <com/sun/star/packages/zip/ZipFileAccess.hpp> +#include <com/sun/star/security/XCertificate.hpp> #include <basic/basrdll.hxx> #include <cppunit/TestAssert.h> @@ -24,6 +25,7 @@ #include <osl/file.hxx> #include <osl/process.h> #include <osl/thread.h> +#include <tools/datetime.hxx> #include <unotools/tempfile.hxx> #include <unotools/ucbstreamhelper.hxx> @@ -169,6 +171,18 @@ void MacrosTest::tearDownNssGpg() (void)this; #endif } + +css::uno::Reference<css::security::XCertificate> MacrosTest::GetValidCertificate( + const css::uno::Sequence<css::uno::Reference<css::security::XCertificate>>& certs) +{ + auto it + = std::find_if(certs.begin(), certs.end(), [now = DateTime(DateTime::SYSTEM)](auto& xCert) { + return now.IsBetween(xCert->getNotValidBefore(), xCert->getNotValidAfter()); + }); + if (it != certs.end()) + return *it; + return {}; +} } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |