Certificate Detection

From Apache OpenOffice Wiki
Revision as of 21:32, 1 May 2014 by Kschenk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

OS Dependent Information

On Windows, OpenOffice will use certificates from the personal key store.

On Macintosh systems, OpenOffice will use certificates from the Mozilla key store (used by Firefox). Users will need to set an environment variable, MOZILLA_CERTIFICATE_FOLDER. A typical example might look like:

 MOZILLA_CERTIFICATE_FOLDER="sql:/Users/xxx/Library/Application Support/Firefox /Profiles/23d7j.default"

with the last value 23d7j.default dependent on your particular setup.

On all other platforms (Linux, Solaris), OpenOffice uses certificate capabilities provided by Mozilla Network Security Services used by Mozilla apps like Firefox and Thunderbird.

Detection order is

  1. Thunderbird
  2. Mozilla
  3. Firefox
  4. Default (what ever that means...)

Unfortunately, there is no option to choose another profile. If you are having problems with OpenOffice not finding your digital certificate, you can manually set the location by using the environment variable MOZILLA_CERTIFICATE_FOLDER. Typically, on many *nix systems, the certificate folder [can be found] at $HOME/.pki/nssdb. So, the following lines would need to be included in your default profile control file (maybe .bashrc or .profile)

 export NSS_USE_SHARED_DB=enabled 

If you still experience problems, please see the [additional information from Mozilla] as well.

More Info for the Adventurous

Finally, you can check the detection with this small basic script:

Option Explicit

Sub MozProfile
	Dim oMozBootstrap as Object
	Dim sMsg as String
	Dim sDefault as String

	oMozBootstrap = createUnoService( "com.sun.star.mozilla.MozillaBootstrap" )
	sMsg = "OpenOffice.org Mozilla Profile Detection" + Chr$(10) + Chr$(10)
	CheckMozProfile( oMozBootstrap, "Thunderbird", com.sun.star.mozilla.MozillaProductType.Thunderbird, sMsg, sDefault )
	sMsg = sMsg + Chr$(10)
	CheckMozProfile( oMozBootstrap, "Mozilla", com.sun.star.mozilla.MozillaProductType.Mozilla, sMsg, sDefault )
	sMsg = sMsg + Chr$(10)
	CheckMozProfile( oMozBootstrap, "Firefox", com.sun.star.mozilla.MozillaProductType.Firefox, sMsg, sDefault )
	sMsg = sMsg + Chr$(10)
	CheckMozProfile( oMozBootstrap, "Default", com.sun.star.mozilla.MozillaProductType.Default, sMsg, sDefault )
	sMsg = sMsg + Chr$(10)
	sMsg = sMsg + "The first detected path will be used for certificates:" + Chr$(10)
	if Len( sDefault ) > 0 Then
		sMsg = sMsg + sDefault
		sMsg = sMsg + "No profile found!"
	end if
	sMsg = sMsg + Chr$(10) + Chr$(10) + "You can overwrite the path with environment variable MOZILLA_CERTIFICATE_FOLDER" + Chr$(10) + " "
	MsgBox sMsg,64

End Sub

Sub CheckMozProfile( oMozBootstrap, TypeName, TypeID, sMsg, sDefault )
	Dim sProfile as String
	Dim sPath as String

	sMsg = sMsg + TypeName + ":" + Chr$(10) + "Profile name: "
	sProfile = 	oMozBootstrap.getDefaultProfile(TypeID)
	if Len( sProfile ) > 0 Then
		sMsg = sMsg + sProfile
		sPath = oMozBootstrap.getProfilePath(TypeID, sProfile )
		sMsg = sMsg + Chr$(10) + "Profile path: " + sPath + Chr$(10)
		if Len( sDefault ) = 0 Then
			sDefault = sPath
		end if
		sMsg = sMsg + "NOT FOUND" + Chr$(10)
End Sub

Launching this code gives all the information you need to modify the environment variable MOZILLA_CERTIFICATE_FOLDER :


See also

Personal tools