I am using the SWT Browser Widget to load the image of a webcam-server via HTTPS. Sadly the webcam-server certificate is untrusted. I tried to 2 variants to load the image:
Browser.setHTML(String)
Load the image using HTML+JavaScript every second. This is the prefered way to avoid flickering. This works very fine for HTTP, if i have a HTTPS connection i will see noting at all except my alternative text.Browser.setUrl(String)
Load the image by setting the URL every second. This causes massiv flickering because of the reload, wich is unacceptable. I tried this variant with all available SWT-Browsers. If i useSWT.WEBKITorSWT.MOZILLA(XulRunner) i have no chance at all to get the image. An dialog pop up and tell me the certificate is untrusted with no option to accept it. If i useSWT.NONEthe IE is used (i am on WinXP) and the pop-up dialog ask if i want to trust the cert, after pressing OK i can see the image.
Here at Stackoverflow i found: how-to-import-a-ssl-certificate-file-with-swt-browser.
But i unable to find the cert_override.txt in my XULRunner, and i am unable to find a download link for the Personal Security Manager (like many others) !
How can i allow the untrusted certificate, use variant 1 and XULRunner aka MOZILLA ? Is it possible to do it programmatically ?
cert_override.txtis located in the user’s profile. On Windows the directory for XULRunner’s user profiles is%APPDATA%\<vendor>\<product>\Profiles\<something>.default, on OS X/Library/Application Support/<product>/Profiles/<something>.default, on Linux~/.<vendor>/<product>/Profiles/<something>.default. At runtime you can use nsIDirectoryService to locate the directory (ProfDis the key for this directory).You can either write to the user’s profile directly from your application or add a copy of
cert_override.txtto your XULRunner application to be copied into all user profiles created (it would have to be put underdefaults/profile/cert_override.txtin the XULRunner application directory). Note that the latter will only have an effect on new profiles being created, not on profiles that already exist.Btw, the simplest way to create a
cert_override.txtfile would be accepting an untrusted certificate in Firefox and then copying the entry from the Firefox profile to the XULRunner profile.