Created
August 24, 2015 17:29
-
-
Save Ruzzz/9a772452c1bc919f7496 to your computer and use it in GitHub Desktop.
Prepare certificate with public key in PEM (text) or DER (binary) formats for Android /system/etc/security/cacerts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Contact: ruzzzua@gmail.com | |
:: Version: 2015.08.14 | |
:: Dependencies: OpenSSL | |
@echo off | |
if "%1"=="" goto :USAGE | |
if "%1"=="-der" goto :DER | |
:PEM | |
for /f %%i in ('openssl x509 -in %1 -hash -noout') do set FILENAME=%%i.0 | |
openssl x509 -in %1 > %FILENAME% | |
openssl x509 -in %1 -text -fingerprint -noout >> %FILENAME% | |
goto :eof | |
:DER | |
if "%2"=="" goto :USAGE | |
for /f %%i in ('openssl x509 -inform der -in %2 -hash -noout') do set FILENAME=%%i.0 | |
openssl x509 -inform der -in %2 > %FILENAME% | |
openssl x509 -inform der -in %2 -text -fingerprint -noout >> %FILENAME% | |
goto :eof | |
:USAGE | |
echo Prepare certificate with public key in PEM (text) or DER (binary) formats | |
echo for Android /system/etc/security/cacerts | |
echo Usage: %~nx0 [-der] cert-file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment