본문 바로가기

NSIS/Reference

[NSIS] 사설 인증서 등록

반응형
# 사용 예
# Call Registering_Certificate_In_Trusted_Root_Certification_Authorities

Function Registering_Certificate_In_Trusted_Root_Certification_Authorities
	# 사설 인증서 등록 (IE, 크롬, 사파리, 오페라)
	${AddCertificateToStore} $0 "$VAR_INSTDIR\cert\${CERT_NAME_COMPANY_ROOT_AUTHORITY}"
	${If} $0 != success
		MessageBox MB_OK "certificate import failed: $0"
	${EndIf}

	${AddCertificateToStore} $0 "$VAR_INSTDIR\cert\${CERT_NAME_DIGICERT_HIGH_ASSURANCE_EV_ROOT_CA}"
	${If} $0 != success
		MessageBox MB_OK "certificate import failed: $0"
	${EndIf}

	${AddCertificateToStore} $0 "$VAR_INSTDIR\cert\${CERT_NAME_DIGICERT_TRUSTED_ROOT_G4}"
	${If} $0 != success
		MessageBox MB_OK "certificate import failed: $0"
	${EndIf}

	# 사설 인증서 등록 (파이어폭스)
	System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r2, i ${CSIDL_APPDATA}, i0)i.r0'
	IfFileExists "$2\Mozilla\Firefox\profiles.ini" EXIST_FIREFOX NON_EXIST_FIREFOX
	EXIST_FIREFOX:
		${nsProcess::KillProcess} "firefox.exe" $R0

		SetShellVarContext current

		ReadINIStr $7 "$2\Mozilla\Firefox\profiles.ini" "Profile0" "Path"

		StrCpy $8 "$2\Mozilla\Firefox\$7"

		ExecCmd::exec /TIMEOUT=2000 '""$VAR_INSTDIR\certutil.exe" -A -n "COMPANY Root Authority - SSO" -t "TCu,Cuw,Tuw" -i "$VAR_INSTDIR\${CERT_NAME_COMPANY_ROOT_AUTHORITY}" -d "$8""'
		ExecCmd::exec /TIMEOUT=2000 '""$VAR_INSTDIR\certutil.exe" -A -n "COMPANY Root Authority - SSO" -t "TCu,Cu,Tu" -i "$VAR_INSTDIR\${CERT_NAME_COMPANY_ROOT_AUTHORITY}" -d "sql:$8""'

		ExecCmd::exec /TIMEOUT=2000 '""$VAR_INSTDIR\certutil.exe" -A -n "COMPANY Root Authority - SSO" -t "TCu,Cuw,Tuw" -i "$VAR_INSTDIR\${CERT_NAME_DIGICERT_HIGH_ASSURANCE_EV_ROOT_CA}" -d "$8""'
		ExecCmd::exec /TIMEOUT=2000 '""$VAR_INSTDIR\certutil.exe" -A -n "COMPANY Root Authority - SSO" -t "TCu,Cu,Tu" -i "$VAR_INSTDIR\${CERT_NAME_DIGICERT_HIGH_ASSURANCE_EV_ROOT_CA}" -d "sql:$8""'

		ExecCmd::exec /TIMEOUT=2000 '""$VAR_INSTDIR\certutil.exe" -A -n "COMPANY Root Authority - SSO" -t "TCu,Cuw,Tuw" -i "$VAR_INSTDIR\${CERT_NAME_DIGICERT_TRUSTED_ROOT_G4}" -d "$8""'
		ExecCmd::exec /TIMEOUT=2000 '""$VAR_INSTDIR\certutil.exe" -A -n "COMPANY Root Authority - SSO" -t "TCu,Cu,Tu" -i "$VAR_INSTDIR\${CERT_NAME_DIGICERT_TRUSTED_ROOT_G4}" -d "sql:$8""'
	NON_EXIST_FIREFOX:
FunctionEnd



Function Certificate_Install_Registeration_Delete
	Call Install_Certificate
	
	Call Registering_Certificate_In_Trusted_Root_Certification_Authorities

	Call Delete_Certificate
FunctionEnd
반응형