SSL Certificate Upload

Aus Gude Systems GmbH
Zur Navigation springen Zur Suche springen

Creating SSL Certifcate Uploadfile using OpenSSL

  • create key file
  • create cert file
  • concatenate key plus cert to one single file


example RSA 2048 file

-----BEGIN RSA PRIVATE KEY-----
MIIEogIBAAKCAQEApphMgn5oYJGB6GZs1dM1VlxkY/6eGA468ubhAFpNHJmDbE2t
zmGZTA/QGYOR0184DSQc30O73ZfVDBzGZOYWRDZnjxco+LUZNnQdJED8zxVT3OT9
b05263TOMFvQL88tgovyWN3JN9KQncq9j+JohxIUdirmYIgJJKIMu81HNbkYLo3U
LLRUTD3UguVWZKWF7UwK/CFHuYqGJbYHMP/LT6P1iQ/bNrtktEo1nPZmrZzuzDn/
GtORzJrYDNCgmJfJYuwuI6bQ1izEn1dvJKldp65O6um+K83eeXCdikLNA8edGCcH
AQQ7zwUy+R3Z7hdeuznbNzL9BNAwfAdgSD8DIwIDAQABAoIBAB2q650lk8L2xrKz
YthlZ488nugr1M2l4xuUwCcG7cqVEBF+d+BUAy/HdSDGDHce8uVsM/QSpOcefeNN
UItxai+1nJWf4zz/S0EmRnZJWHwsaSXiZbuntofR4lI8V4PcGlewQnVO8eGODxD6
pO11vXWoY5pzo1k3gKFUdn4PXYoUZbpBK74rADDmjPiAqOMuXPx1b0hr2JIHYioI
7SerBlZZAIDqCagcJULKK+V84wwMhz9cbM7dTnjk1xcrtP+tjx7wQqlomX9WvQsr
huxqEKC2Zl7JJfKtrH3kY93od7y5lrDIcUfUIAjMmftfwolEk60u5tBj1KA2s+9Y
XB1KofECgYEA13BmzOWn71hRWyGEzJfnMGNmiRBtVvFCR70WMbq+xhEx1yqLezLT
H7/IMu7mAPuL0Wy2v1c+bXL9jONm9idjkbQWxyQK56A6AwyZHpUdtiBC5YpwXg5i
GvhhpyrsroESE+ggYn9f+9z1hXQ7v+p2sMnPrsoik0BEoLa/RH6FVesCgYEAxfW8
u54GcTHOpVB+1+9JAG+WaqaxhyXE2cNYJaRmkpVBg7s5Jf6lth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dM1VlxkY/6eGA46
8ubhAFpNHJmDbE2tzmGZTA/QGYOR0184DSQc30O73ZfVDBzGZOYWRDZnjxco+LUZ
NnQdJED8zxVT3OT9b05263TOMFvQL88tgovyWN3JN9KQncq9j+JohxIUdirmYIgJ
JKIMu81HNbkYLo3ULLRUTD3UguVWZKWF7UwK/CFHuYqGJbYHMP/LT6P1iQ/bNrtk
tEo1nPZmrZzuzDn/GtORzJrYDNCgmJfJYuwuI6bQ1izEn1dvJKldp65O6um+K83e
eXCdikLNA8edGCcHAQQ7zwUy+R3Z7hdeuznbNzL9BNAwfAdgSD8DIwIDAQABo1Aw
TjAdBgNVHQ4EFgQUAm+M2WvzDvBabhAUny5BzRc4SDswHwYDVR0jBBgwFoAUAm+M
2WvzDvBabhAUny5BzRc4SDswDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOC
AQEAhmjfFdvb4bO7qxtdD73IqnevEG8lEJhLtRf4vNTQ/0VpgfWXLD36EgNRfK3G
0+581GVawbVW9C5lY6WM98yZYg+2Pep1Qhauzs5ccOo8RVXx7vSGJ5pymjhW25Rm
cc2DtYcBkCG55PLGVtD9uMWWM6kSIXfgYJeFzLA/MaaeaOXEFWnobSPy2J2P0jxU
DZtnm4vp+L4uoAlVv7HypsN57idrfqBmZ6yF+wvkUxlouddE+R7Rl3EOWLImDcwy
d5teYTjOHLF37+1Kca9PUdpIxQrPw7+JloBuZNPPImhUVLKIbrk+QhI2M0s0ohqK
KkCMc4xRYHKYJtSBP4j7LgsqkQ==
-----END CERTIFICATE-----


create_snakeoil.bat

@echo off

SET CN="%1"
IF NOT [%CN%]==[""] GOTO CREATE
SET CN="localhost"

:CREATE
openssl\openssl.exe genrsa -out snakeoil.key 2048
openssl\openssl.exe req -config openssl\openssl.cnf -new -x509 -key snakeoil.key -out snakeoil.crt -days 14600 -subj "/C=DE/ST=NRW/L=CGN/O=IT/CN=%CN%" 

type snakeoil.key > snakeoil.pem
type snakeoil.crt >> snakeoil.pem


create_snakeoil.sh

#!/bin/bash

if [ "$1" == "" ]; then
  CN="localhost"
else
  CN="$1"
fi

openssl genrsa -out snakeoil.key 2048
openssl req -new -x509 -key snakeoil.key -out snakeoil.crt -days 14600 -subj "/C=DE/ST=NRW/L=CGN/O=IT/CN=$CN" 

cat snakeoil.key > snakeoil.pem
cat snakeoil.crt >> snakeoil.pem

echo ""
ls -la snakeoil.pem
cat snakeoil.pem

Upload

Upoload Certifcate via curl in command line

 curl --verbose --progress-bar -F file=@./snakeoil.pem "http://192.168.0.2/fwupdate.html?type=1"