Thank you very much for attempting to answer my question. I appreciate it.
I ran the non-Rebex .NET code that you gave above, and it works successfully, whether the service is running as the Windows user or if the service is running as LocalSystem. It always works. In both cases, it finds 313 certificates in the local store and 313 certificates in the user store. So it's returning the same certificate list under both users.
I also attempted your certificate validation handler workaround. When running the service as the Windows user, I now get the following error:
>2015-04-14 17:23:00.081 ERROR Ftp(4) Info: Rebex.Net.TlsException: Server certificate was rejected by the verifier because it is bad. ---> Rebex.Net.TlsException: Server certificate was rejected by the verifier because it is bad. ---> Rebex.Net.TlsException: Server certificate was rejected by the verifier because it is bad. ---> Rebex.Net.TlsException: Server certificate was rejected by the verifier because it is bad.
at Rebex.Net.WHB.CE(String A, CertificateChain B)
at Rebex.Net.WHB.EE(Byte[] A, Int32 B, Int32 C, HHB D)
at Rebex.Net.WHB.KC(Byte[] A, Int32 B, Int32 C)
at Rebex.Net.VHB.CD(Byte[] A, Int32 B, Int32 C)
at Rebex.Net.VHB.HD()
--- End of inner exception stack trace ---
at Rebex.Net.VHB.HD()
at Rebex.Net.VHB.PD()
at Rebex.Net.TlsSocket.Negotiate()
at Rebex.Net.CS.UB(TlsParameters A)
at Rebex.Net.Ftp.BN(String A, Int32 B, TlsParameters C, FtpSecurity D)
--- End of inner exception stack trace ---
at Rebex.Net.Ftp.BN(String A, Int32 B, TlsParameters C, FtpSecurity D)
--- End of inner exception stack trace ---
at Rebex.Net.Ftp.BN(String A, Int32 B, TlsParameters C, FtpSecurity D)
However, when I run the service as LocalSystem, the certificate validates successfully. So the program still works only when running as LocalSystem.
Any other ideas why this might be failing when running as the Windows user?