Skip to content

Commit

Permalink
Added batch files for Windows Devices
Browse files Browse the repository at this point in the history
  • Loading branch information
anandbhaskaran committed Aug 13, 2014
1 parent 5d0e268 commit 1099b5c
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
51 changes: 51 additions & 0 deletions scripts/make_certs.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
@echo off
choice /m "Do you have CA?"
IF ERRORLEVEL 2 GOTO BUILDCA
IF ERRORLEVEL 1 GOTO INBUILTCA
:BUILDCA

echo 1. Creating Certificate Authority (CA)
echo For 'Common Name' enter something like 'MDM Test CA
openssl req -new -x509 -extensions v3_ca -keyout cakey.key -out cacert.crt -days 365

:CONT
echo 2. Creating the Web Server private key and certificate request
echo For 'Common Name' enter your server's IP address
openssl genrsa 2048 > server.key
openssl req -new -key server.key -out server.csr

echo 3. Signing the server key with the CA. You'll the CA passphrase from step 1.
openssl x509 -req -days 365 -in server.csr -CA cacert.crt -CAkey cakey.key -CAcreateserial -out server.crt -extfile .\server.cnf -extensions ssl_server

echo 4. Creating the device Identity key and certificate request.
openssl genrsa 2048 > identity.key
openssl req -new -key identity.key -out identity.csr

echo 5. Signing the identity key with the CA. You'll the CA passphrase from step 1.
echo ** Give it a passphrase. You'll need to include that in the IPCU profile.
openssl x509 -req -days 365 -in identity.csr -CA cacert.crt -CAkey cakey.key -CAcreateserial -out identity.crt
openssl pkcs12 -export -out identity.p12 -inkey identity.key -in identity.crt -certfile cacert.crt


echo 6. Copying keys and certs to server folder
copy server.key ..\server\Server.key
copy server.crt ..\server\Server.crt
copy cacert.crt ..\server\CA.crt
copy identity.p12 ..\server\Identity.p12


echo 7. Generating keys and certs for plist generation
openssl req -inform pem -outform der -in identity.csr -out customer.der
copy Identity.p12 ..\vendor-signing\com\softhinker\vendor.p12
copy customer.der ..\vendor-signing\com\softhinker\customer.der

echo DONE!!
goto end

:INBUILTCA
echo place CA Certificate and CA Key and then press enter. NOTE: you should have the password of the certificate.
@pause
goto CONT

:end
@pause
4 changes: 4 additions & 0 deletions scripts/vendor_signing.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cd ../vendor-signing/com/softhinker
javac -cp "../../lib/dom4j-1.6.1.jar;./" Test.java
cd ../../
java -cp "./lib/dom4j-1.6.1.jar;./" com.softhinker.Test

0 comments on commit 1099b5c

Please sign in to comment.