diff --git a/add-certificates-to-phone-internal-kit-adb.bat b/add-certificates-to-phone-internal-kit-adb.bat new file mode 100644 index 0000000..8fe845d --- /dev/null +++ b/add-certificates-to-phone-internal-kit-adb.bat @@ -0,0 +1,70 @@ +@echo off +:: Run ADB server +@echo Starting ADB server +"bin/adb/adb.exe" start-server + +:: Set environment variable +@echo Enter the NSS DB root directory ( Such as Nokia, enter /data/b2g/mozilla ) +@echo Some phones may be different. +@echo For more information, please visit: https://github.com/openGiraffes/b2g-certificates +@echo: +set /p ROOT_DIR_DB= + +set CERT_DIR=certs +set TEMP=tmp +set CERT=cert9.db +set KEY=key4.db +set PKCS11=pkcs11.txt +for /f %%i in ('"bin/adb/adb.exe" shell "ls -d %ROOT_DIR_DB%/*.default 2>/dev/null" ^|^| "bin/sed.exe" "s/default.*$/default/g"') do set DB_DIR=%%i +@echo %DB_DIR% + +if DB_DIR == "" ( + @echo: + echo "Profile directory does not exists. Please start the b2g process at least once before running this script." + pause +) + +:: Cleanup +rmdir /s /q %TEMP% +mkdir %TEMP% + +:: Pull files from phone +@echo Getting %CERT% +"bin/adb/adb.exe" pull %DB_DIR%/%CERT% ./%TEMP%/ + +@echo Getting %KEY% +"bin/adb/adb.exe" pull %DB_DIR%/%KEY% ./%TEMP%/ + +@echo Getting %PKCS11% +"bin/adb/adb.exe" pull %DB_DIR%/%PKCS11% ./%TEMP%/ + +:: Clear password and add certificates +@echo Set password (hit enter twice to set an empty password) +"bin/nss/certutil.exe" -d %TEMP% -N + +@echo Adding certificates +for %%i in (%CERT_DIR%/*) do ( + echo Adding certificate %%i + "bin/nss/certutil.exe" -d %TEMP% -A -n "`basename %%i`" -t "C,C,TC" -i %CERT_DIR%/%%i +) + +:: Push files to phone +@echo Stopping B2G +"bin/adb/adb.exe" shell stop b2g + +@echo copying %CERT% +"bin/adb/adb.exe" push ./%TEMP%/%CERT% %DB_DIR%/%CERT% +@echo copying %KEY% +"bin/adb/adb.exe" push ./%TEMP%/%KEY% %DB_DIR%/%KEY% +@echo copying %PKCS11% +"bin/adb/adb.exe" push ./%TEMP%/%PKCS11% %DB_DIR%/%PKCS11% + +@echo Starting B2G +"bin/adb/adb.exe" shell start b2g + +@echo Finished. + +@echo Killing ADB server +"bin/adb/adb.exe" kill-server + +pause \ No newline at end of file diff --git a/bin/adb/AdbWinApi.dll b/bin/adb/AdbWinApi.dll new file mode 100644 index 0000000..7abe26c Binary files /dev/null and b/bin/adb/AdbWinApi.dll differ diff --git a/bin/adb/AdbWinUsbApi.dll b/bin/adb/AdbWinUsbApi.dll new file mode 100644 index 0000000..e7a6de1 Binary files /dev/null and b/bin/adb/AdbWinUsbApi.dll differ diff --git a/bin/adb/adb.exe b/bin/adb/adb.exe new file mode 100644 index 0000000..ca474cd Binary files /dev/null and b/bin/adb/adb.exe differ