Skip to content

How can the current time be set for certificate validation #114

Description

@moritz89
  • How does mbedtls get the current time to verify certificates?
    • I remember reading that the compile time is used?
  • Does setting the time with settimeofday affect the time used by mbedtls to verify certificates validity?

Activity

  1. Repository owner deleted a comment from github-actions on May 23, 2025
  2. RobertByrnes commented on May 23, 2025

    @RobertByrnes
    Collaborator

    Hi, mbed-tls uses system time (time()) in embedded systems with linux or similar. However as ESP / Arduino etc is bare metal and doesn't have a real time clock we have to get the time from NTP or from GSM.

    If you set the time with settimeofday, future SSL/TLS handshakes and certificate validations will use the new time.

  3. moritz89 commented on May 23, 2025

    @moritz89
    Author

    Great. So then the process of

    1. connect to internet (LTE/WiFi)
    2. sync time
    3. connect to server

    is the sensible steps to take. Would that mean setting time with settimeofday() far in the future past will cause the SSL/TLS handshake to fail?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions