PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Importieren von Zertifikaten in TinyCA



Mysterious
31.03.06, 10:13
Hi,
habe im Ramen meiner Technikerarbeit eine CA aufgesetzt und mir über ein simples Script(siehe unten) Zertifikate für alle Clients generieren lassen. Da ich die Zertifikate über TinyCA verwalten möchte muss ich die ja irgendwie in TinyCA importieren was sich als bissl schwierig darstellt. unter /.TinyCA gibt es nen Unterordner certs wo die über TinyCA erstellten Zertifikate liegen. LEider klappt es nicht einfach die zertifikate in den Ordner zu kopieren. Hat jemand eine Idee wie ich das hinbekomme? Ich denke das es nur ein Format Problem ist...


#!/bin/sh
echo "************************************************** *******************************"
echo "Creating client private key and certificate"
echo "When prompted enter the client name in the Common Name field. This is the same"
echo " used as the Username in FreeRADIUS"
echo "************************************************** *******************************"
echo

# Request a new PKCS#10 certificate.
# First, newreq.pem will be overwritten with the new certificate request

openssl req -new -keyout newreq.pem -out newreq.pem -passin pass:tester -passout pass:tester -subj '/C=DE/ST=Baden Wuerttemberg/L=Zell am Harmersbach/O=Metaldyne Zell GmbH & Co. KG/OU=IT/CN=tester12 /mail=tobiaspapeke@metaldyne.de'


# Sign the certificate request. The policy is defined in the openssl.cnf file.
# The request generated in the previous step is specified with the -infiles option and
# the output is in newcert.pem
# The -extensions option is necessary to add the OID for the extended key for client authentication

#openssl ca -out test.pem -passin pass:tester -key xxxx -batch -infiles newreq.pem

openssl ca -out newcert.pem -passin pass:tester -key xxxx -batch -extensions xpclient_ext -extfile xpextensions -infiles newreq.pem


# Create a PKCS#12 file from the new certificate and its private key found in newreq.pem
# and place in file specified on the command line

openssl pkcs12 -export -in newcert.pem -inkey newreq.pem -out $1.p12 -clcerts -passin pass:tester -passout pass:tester


# parse the PKCS#12 file just created and produce a PEM format certificate and key in certclt.pem

openssl pkcs12 -in $1.p12 -out $1.pem -passin pass:tester -passout pass:tester


# Convert certificate from PEM format to DER format

openssl x509 -inform PEM -outform DER -in $1.pem -out $1.der


# clean up


rm -rf newcert newreq.pem