This is an automated email from the ASF dual-hosted git repository.

twolf pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mina-sshd.git

commit 18a6e18b824c1c9bafc3b5d53146a58ba2818a77
Author: Thomas Wolf <[email protected]>
AuthorDate: Sat Sep 20 16:36:28 2025 +0200

    OpenSshCertificate: minor clean-up in isValidNow()
---
 .../java/org/apache/sshd/common/config/keys/OpenSshCertificate.java   | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git 
a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java
 
b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java
index f9f0cef30..b18cb5d01 100644
--- 
a/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java
+++ 
b/sshd-common/src/main/java/org/apache/sshd/common/config/keys/OpenSshCertificate.java
@@ -27,7 +27,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.SortedMap;
-import java.util.concurrent.TimeUnit;
 
 import org.apache.sshd.common.util.ValidateUtils;
 
@@ -226,8 +225,7 @@ public interface OpenSshCertificate extends SshPublicKey, 
PrivateKey {
      * @return      {@code true} if the certificate is valid according to its 
timestamps, {@code false} otherwise
      */
     static boolean isValidNow(OpenSshCertificate cert) {
-        long now = TimeUnit.MILLISECONDS.toSeconds(System.currentTimeMillis());
-        return Long.compareUnsigned(cert.getValidAfter(), now) <= 0 && 
Long.compareUnsigned(now, cert.getValidBefore()) < 0;
+        return isValidAt(cert, Instant.now());
     }
 
     /**

Reply via email to