xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx |   11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

New commits:
commit 0e4266dd904ffb79c84f6b281bd822460cc64fde
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Aug 15 16:21:28 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Aug 15 15:46:13 2024 +0200

    Use MacrosTest::IsValid to check certificates
    
    Change-Id: I015fae42cf95ab7ff4f384b17f6ac4994d4c81ad
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171902
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx 
b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
index 38fcf428be74..d37f9d2f5434 100644
--- a/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
+++ b/xmlsecurity/qa/unit/pdfsigning/pdfsigning.cxx
@@ -134,19 +134,10 @@ bool PDFSigningTest::sign(const OUString& rInURL, const 
OUString& rOutURL,
             = xSecurityContext->getSecurityEnvironment();
         uno::Sequence<uno::Reference<security::XCertificate>> aCertificates
             = xSecurityEnvironment->getPersonalCertificates();
-        DateTime now(DateTime::SYSTEM);
         for (auto& cert : asNonConstRange(aCertificates))
         {
-            css::util::DateTime aNotValidAfter = cert->getNotValidAfter();
-            css::util::DateTime aNotValidBefore = cert->getNotValidBefore();
-
             // Only try certificates that are already active and not expired
-            if ((now > DateTime(aNotValidAfter)) || (now < 
DateTime(aNotValidBefore)))
-            {
-                SAL_WARN("xmlsecurity.qa",
-                         "Skipping a certificate that is not yet valid or 
already not valid");
-            }
-            else
+            if (IsValid(cert, xSecurityEnvironment))
             {
                 bool bSignResult = aDocument.Sign(cert, u"test"_ustr, 
/*bAdES=*/true);
 #ifdef _WIN32

Reply via email to