Certificates are valid for a specified period of time, encoded in the certificate. The internal certificate verification algorithm checks that the certificate is valid before proceeding, but your application can also explicitly check a certificate before passing it into a context.
RWX509Certificate has two functions for checking certificate validity with respect to a specified date and time:
RWX509Certificate::isValid(const RWDateTime&) returns true if the certificate is valid relative to the date and time, and returns false otherwise.
RWX509Certificate::throwIfNotValid(const RWDateTime&) throws an exception if the certificate is not valid. For more information, see RWX509Certificate in the Secure Communication Module Reference Guide.
The RWDateTime parameter in Example 5 defaults to the current date and time.
RWX509Certificate cert("server.pem"); RWDateTime longAgo("March 23, 1975", RWDateTime::setDate); if(cert.isValid()) {
cout << "Certificate is valid today!" << endl; } else { cout << "Certificate is not valid today." << endl; } if(cert.isValid(longAgo)) { cout << "Certificate was valid on March 23, 1975" << endl; } else { cout << "Certificate was not valid on March 23, 1975" << endl; }
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.