OpenSSL scripts to create certs for client and server samples.

This commit is contained in:
Martin Regen
2016-07-26 00:18:50 +02:00
parent b749ef2530
commit a26291663f
12 changed files with 52 additions and 0 deletions
@@ -0,0 +1,14 @@
#!/bin/bash
# Create a UA Sample Client cert for OPC UA client
#
openssl req -newkey rsa:1024 -out cert.crt -keyout cert.key -subj "/DC=$HOSTNAME/CN=UA Sample Client" -nodes
openssl x509 -days 365 -req -in cert.crt -signkey cert.key -out cert.pem -sha1 -extfile sampleclient.ext
openssl pkcs12 -export -in cert.pem -inkey cert.key -out $HOSTNAME.pfx -nodes
openssl x509 -in cert.pem -out $HOSTNAME.der -outform DER
openssl x509 -in $HOSTNAME.der -inform DER -text
rm cert.*
mkdir -p "./OPC Foundation/CertificateStores/MachineDefault/certs"
mkdir -p "./OPC Foundation/CertificateStores/MachineDefault/private"
mv $HOSTNAME.der "./OPC Foundation/CertificateStores/MachineDefault/certs"
mv $HOSTNAME.pfx "./OPC Foundation/CertificateStores/MachineDefault/private"
@@ -0,0 +1,8 @@
# Extensions to add to a certificate request
subjectKeyIdentifier=hash
subjectAltName=URI:urn:localhost:OPCFoundation:SampleClient
authorityKeyIdentifier=critical,keyid,issuer:always
basicConstraints = critical, CA:FALSE
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment, keyCertSign
extendedKeyUsage = critical, serverAuth, clientAuth
@@ -0,0 +1,8 @@
REM create the app certificate for NetCoreConsoleServer
set CERTSTORE=".\OPC Foundation\CertificateStores\MachineDefault"
rd /S/Q %CERTSTORE%
md %CERTSTORE%
Opc.Ua.CertificateGenerator.exe -cmd issue -sp %CERTSTORE% -an "UA Sample Server" -dn %COMPUTERNAME% -sn "CN=UA Sample Server/DC=%COMPUTERNAME%" -au "urn:localhost:OPCFoundation:SampleServer
set CERTSTORE=
@@ -0,0 +1,14 @@
#!/bin/bash
# Create a UA Sample Server cert for OPC UA server
#
openssl req -newkey rsa:1024 -out cert.crt -keyout cert.key -subj "/DC=$HOSTNAME/CN=UA Sample Server" -nodes
openssl x509 -days 365 -req -in cert.crt -signkey cert.key -out cert.pem -sha1 -extfile sampleserver.ext
openssl pkcs12 -export -in cert.pem -inkey cert.key -out $HOSTNAME.pfx -nodes
openssl x509 -in cert.pem -out $HOSTNAME.der -outform DER
openssl x509 -in $HOSTNAME.der -inform DER -text
rm cert.*
mkdir -p "./OPC Foundation/CertificateStores/MachineDefault/certs"
mkdir -p "./OPC Foundation/CertificateStores/MachineDefault/private"
mv $HOSTNAME.der "./OPC Foundation/CertificateStores/MachineDefault/certs"
mv $HOSTNAME.pfx "./OPC Foundation/CertificateStores/MachineDefault/private"
@@ -0,0 +1,8 @@
# Extensions to add to a certificate request
subjectKeyIdentifier=hash
subjectAltName=URI:urn:localhost:OPCFoundation:SampleClient
authorityKeyIdentifier=critical,keyid,issuer:always
basicConstraints = critical, CA:FALSE
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment, dataEncipherment, keyCertSign
extendedKeyUsage = critical, serverAuth, clientAuth