Ephenodrom / Dart-Basic-Utils

A dart package for many helper methods fitting common situations
MIT License
368 stars 79 forks source link

Support for a custom "Not Before" date for the validity of self signed X.509 certificates #106

Closed Nikoo00o closed 1 year ago

Nikoo00o commented 1 year ago

Hi, i'm back with another small addition for the x.509 certificates.

Because of a small time sync problem during the communication, one device managed to produce certificates that are not valid yet. Instead of having to add delays, it would be nice if we could set a custom "Not Before" Validity inside of the certificate.

For example: the time of a device is ahead of the time of the server. The device now creates a self signed certificate and sends it to the server, but for the server the certificate is not valid yet (because the certificate would only be valid in like a minute, or so).

I already created the following pull request: https://github.com/Ephenodrom/Dart-Basic-Utils/pull/105

droider91 commented 1 year ago

Hello @Nikoo00o Is there any way out to read the certificates, user installed on the device?

Nikoo00o commented 1 year ago

Hi @droider91, yes, you can use X509Utils.x509CertificateFromPem with the encoded file content if that's what you meant.

droider91 commented 1 year ago

@Nikoo00o I want to read all installed certificate (X509) on a device. I do not have any certificate or string in my app itself. Just have to grab in device and want to list out the installed certificate.

Nikoo00o commented 1 year ago

@droider91 I don't know if you may access those files directly, or if you have to use platform specific code with the keystore, etc to access them. But this function is not implemented in this library, so you would have to implement it yourself.

Nikoo00o commented 1 year ago

This issue is closed with the pull request.