Преглед изворни кода

renaming server certificate to "server_cert.der", adding a self signed certificate to release, should work out, at least for CTT

Stasik0 пре 9 година
родитељ
комит
6af73e48f4
4 измењених фајлова са 15 додато и 12 уклоњено
  1. 9 6
      .travis.yml
  2. 1 1
      examples/server.c
  3. 1 1
      examples/server_simple.c
  4. 4 4
      tools/certs/create_self-signed.py

+ 9 - 6
.travis.yml

@@ -32,9 +32,10 @@ script:
 - echo "Documentation build"
 - mkdir -p build
 - cd build
-- cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON ..
+- cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_DOCUMENTATION=ON -DGENERATE_SELFSIGNED=ON ..
 - make -j doc
 - cp -r doc ..
+- cp server_cert.der ..
 - echo "Testing builds"
 - cd .. && rm build -rf && mkdir -p build && cd build
 - echo "Cross compile release build for MinGW 32 bit"
@@ -44,7 +45,8 @@ script:
 - cp ../LICENSE .
 - cp ../AUTHORS .
 - cp -r ../doc .
-- zip -r open62541-win32.zip doc LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
+- cp ../server_cert.der .
+- zip -r open62541-win32.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
 - cp open62541-win32.zip ..
 - cd .. && rm build -rf && mkdir -p build && cd build
 - echo "Cross compile release build for MinGW 64 bit"
@@ -54,19 +56,20 @@ script:
 - cp ../LICENSE .
 - cp ../AUTHORS .
 - cp -r ../doc .
-- zip -r open62541-win64.zip doc LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
+- cp ../server_cert.der .
+- zip -r open62541-win64.zip doc server_cert.der LICENSE AUTHORS README.md server_static.exe server.exe client.exe client_static.exe libopen62541.dll libopen62541.dll.a open62541.h open62541.c
 - cp open62541-win64.zip ..
 - cd .. && rm build -rf && mkdir -p build && cd build
 - echo "Cross compile release build for 32-bit linux"
 - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-gcc-m32.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
 - make -j
-- tar -pczf open62541-linux32.tar.gz ../doc ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
+- tar -pczf open62541-linux32.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
 - cp open62541-linux32.tar.gz ..
 - cd .. && rm build -rf && mkdir -p build && cd build
 - echo "Compile release build for 64-bit linux"
 - cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_AMALGAMATION=ON -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
 - make -j
-- tar -pczf open62541-linux64.tar.gz ../doc ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
+- tar -pczf open62541-linux64.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
 - cp open62541-linux64.tar.gz ..
 - cp open62541.h .. #copy single file-release
 - cp open62541.c .. #copy single file-release
@@ -98,7 +101,7 @@ before_deploy:
 - export PATH=$PATH:~/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/
 - cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-rpi64.cmake -DENABLE_AMALGAMATION=ON -DCMAKE_BUILD_TYPE=Release -DBUILD_EXAMPLESERVER=ON -DBUILD_EXAMPLECLIENT=ON ..
 - make -j
-- tar -pczf open62541-raspberrypi.tar.gz ../doc ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
+- tar -pczf open62541-raspberrypi.tar.gz ../doc ../server_cert.der ../LICENSE ../AUTHORS ../README.md server_static server client_static client libopen62541.so open62541.h open62541.c
 - cp open62541-raspberrypi.tar.gz ..
 - cd ..
 deploy:

+ 1 - 1
examples/server.c

@@ -189,7 +189,7 @@ static UA_ByteString loadCertificate(void) {
 	UA_ByteString certificate = UA_STRING_NULL;
 	FILE *fp = NULL;
 	//FIXME: a potiential bug of locating the certificate, we need to get the path from the server's config
-	fp=fopen("localhost.der", "rb");
+	fp=fopen("server_cert.der", "rb");
 
 	if(!fp) {
         errno = 0; // we read errno also from the tcp layer...

+ 1 - 1
examples/server_simple.c

@@ -32,7 +32,7 @@ static UA_ByteString loadCertificate(void) {
     UA_ByteString certificate = UA_STRING_NULL;
 	FILE *fp = NULL;
 	//FIXME: a potiential bug of locating the certificate, we need to get the path from the server's config
-	fp=fopen("localhost.der", "rb");
+	fp=fopen("server_cert.der", "rb");
 
 	if(!fp) {
         errno = 0; // we read errno also from the tcp layer...

+ 4 - 4
tools/certs/create_self-signed.py

@@ -40,7 +40,7 @@ os.system("""openssl x509 -req \
 	-out localhost.crt \
 	-extensions v3_ca \
 	-extfile localhost.cnf""")
-os.system("""openssl x509 -in localhost.crt -outform der -out localhost.der""")
+os.system("""openssl x509 -in localhost.crt -outform der -out server_cert.der""")
 #we will need these files later
 os.remove("localhost.key") #we will need it later
 os.remove("localhost.crt")
@@ -48,9 +48,9 @@ os.remove("localhost.csr")
 os.remove("ca.key")
 os.remove("ca.srl")
 
-if os.path.isfile(os.path.join(sys.argv[1], "localhost.der")):
-	os.remove(os.path.join(sys.argv[1], "localhost.der"))
-shutil.move("localhost.der", sys.argv[1])
+if os.path.isfile(os.path.join(sys.argv[1], "server_cert.der")):
+	os.remove(os.path.join(sys.argv[1], "server_cert.der"))
+shutil.move("server_cert.der", sys.argv[1])
 if os.path.isfile(os.path.join(sys.argv[1], "ca.crt")):
 	os.remove(os.path.join(sys.argv[1], "ca.crt"))
 shutil.move("ca.crt", sys.argv[1])