From 1099b5cc20505839a48b35e924ae7f239b069598 Mon Sep 17 00:00:00 2001 From: Anand Date: Wed, 13 Aug 2014 15:10:48 +0530 Subject: [PATCH] Added batch files for Windows Devices --- scripts/make_certs.bat | 51 ++++++++++++++++++++++++++++++++++++++ scripts/vendor_signing.bat | 4 +++ 2 files changed, 55 insertions(+) create mode 100644 scripts/make_certs.bat create mode 100644 scripts/vendor_signing.bat diff --git a/scripts/make_certs.bat b/scripts/make_certs.bat new file mode 100644 index 0000000..1f7e654 --- /dev/null +++ b/scripts/make_certs.bat @@ -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 diff --git a/scripts/vendor_signing.bat b/scripts/vendor_signing.bat new file mode 100644 index 0000000..2135661 --- /dev/null +++ b/scripts/vendor_signing.bat @@ -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