rem set OPENSSL_CONF=%T%\openssl-0.9.8d_X64\openssl.cnf
rem %T%\openssl-0.9.8d_X64\bin\openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -sha256 -nodes -subj "/C=DE/ST=Sindelfingen/L=Baden-Wuerttemberg/O=innovaphone AG/OU=Development Department/CN=localhost"
echo 01 >serial.txt
%T%\openssl-0.9.8d_X64\bin\openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 3650 -sha256 -nodes -config openssl-localhost.cnf

copy selfsignedcert.pem cert.pem
copy selfsignedkey.pem key.pem

%T%\openssl-0.9.8d_X64\bin\openssl x509 -in cert.pem -text -noout
%T%\openssl-0.9.8d_X64\bin\openssl x509 -purpose -in cert.pem -inform PEM
copy cert.pem cert.txt
echo( >>cert.txt
copy /B cert.txt+key.pem localhostcert.pem
dos2unix localhostcert.pem
exe\bin2c localhostcert.pem common\ios\ios\localhostcert.h
copy cert.pem cert.txt
exe\replace cert.txt "-----BEGIN CERTIFICATE-----" ""
exe\replace cert.txt "-----END CERTIFICATE-----" ""
copy /B mobileconfig_prefix.txt+cert.txt+mobileconfig_suffix.txt cert.mobileconfig
dos2unix cert.mobileconfig
set RANDFILE=.rnd
%T%\openssl-0.9.8d_X64\bin\openssl smime -sign -in cert.mobileconfig -out certsigned.mobileconfig -signer star_innovaphone_com.pem -certfile star_innovaphone_com.pem -outform der -nodetach

copy selfsignedsigned.mobileconfig certsigned.mobileconfig

exe\bin2c certsigned.mobileconfig common\ios\ios\localhostmobileconfig.h
