How do I use current date & time as the value for the findValue attribute in the ServiceCertificate config when using “FindByTimeValid” for the x509FindType? Using DateTime.Now as below obiously doesn’t work but neither does “2010-10-20 14:35:28Z”. I have two certificates on the server with the same details as one of them has expired which is why I’m using this find type value.
For example:
<serviceCredentials>
<serviceCertificate findValue="DateTime.Now" x509FindType="FindByTimeValid" storeLocation="LocalMachine" storeName="My"/>
</serviceCredentials>
Edit: I fixed this by removing the expired certificate but I’m still curious if this is possible.
Thanks
Keith
As no-one seems slightly interested in this question (2 views in a month and I think at least one of them was me) I decided to break out Reflector and have a look at the process and have found the following.
In the
X509Certificate2Collection.FindCertInStore(SafeCertStoreHandle safeSourceStoreHandle, X509FindType findType, object findValue, bool validOnly)method of the System.ServiceModel assembly we have the following codeAs you can see from the signature the findValue comes in as an object which I think is in turn loaded by the config parser as a string which means this will never work.
So the answer is you can’t do this though the xml config but you can if you do it programmatically.