{"id":2723,"date":"2026-09-11T09:05:26","date_gmt":"2026-09-11T07:05:26","guid":{"rendered":"https:\/\/hitco.at\/blog\/?p=2723"},"modified":"2026-09-11T09:15:03","modified_gmt":"2026-09-11T07:15:03","slug":"certificate-authority-windows-powershell-ca-smime-codesigning","status":"publish","type":"post","link":"https:\/\/hitco.at\/blog\/certificate-authority-windows-powershell-ca-smime-codesigning\/","title":{"rendered":"Certificate Authority unter Windows mit PowerShell betreiben"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">R\u00fcckblick: Vor ein paar Jahren habe ich unter <a href=\"https:\/\/hitco.at\/blog\/s-mime-zertifikate-mit-openssl-ca\/\" data-type=\"post\" data-id=\"1451\" target=\"_blank\" rel=\"noopener\">S\/MIME-Zertifikate mittels klickfertiger OpenSSL-CA selbst erstellen<\/a> erl\u00e4utert, wie mittels ein paar Scripts basierend auf OpenSSL eine Certificate Authority (CA) instanziiert und zur Zertifikatsausstellung genutzt wird.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Mit diesem Blog-Post hier demonstriere ich, wie unter Verwendung von Windows 11 Bordmitteln (Powershell, es wird kein OpenSSL ben\u00f6tigt) eine CA erstellt und daraus Code-Signing-Zertifikate, Webserver-Zertifikate, Benutzer-Zertifikate f\u00fcr TLS-Client-Auth, S\/MIME Mail-Signatur und Mail-Verschl\u00fcsselung sowie Smartcard-Anmeldung ausgestellt werden.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Die nachfolgende Anleitung nutzt hierzu das in Windows enthaltene PowerShell-Commandlet <strong><code>New-SelfSignedCertificate<\/code><\/strong>, welches von Microsoft grunds\u00e4tzlich <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/pki\/new-selfsignedcertificate\" target=\"_blank\" rel=\"noopener\">ausreichend dokumentiert<\/a> ist. Aber: Der dokumentierte und intendierte Zweck seitens Microsoft ist augenscheinlich damit (nur) Selfsigned-Zertifikate auszustellen. Dieses PowerShell-Commandlet eignet sich aber nicht nur zur Erstellung von Self-Signed-Zertifikaten. Es kann als universelles Zertifikats-Erstellungs-Instrument genutzt werden, mit dem wir nun eine CA, sowie von dieser CA signierte Zertifikate f\u00fcr unterschiedliche Zwecke ausstellen werden.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Das PowerShell-Commandlet <strong><code>New-SelfSignedCertificate<\/code><\/strong> steht sowohl in der mit Windows 11 mitgelieferten PowerShell Version 5, als auch in der modernen PowerShell 7 zur Verf\u00fcgung.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Die PowerShell-Code-Zeilen k\u00f6nnen grunds\u00e4tzlich inklusive der hervorgehobenen Kommentarzeilen direkt 1:1 in die PowerShell-Konsole kopiert werden um den Vorgang nachzuvollziehen.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">CA, Root-Zertifikat, Certificate Authority<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Das CA-Zertifikat erzeugen wir uns mit folgenden PowerShell-Code-Zeilen:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; highlight: [1,11,20,24]; title: ; notranslate\" title=\"\">\n# Die TextExtension des CA-Zertifikats vorbereiten\n$BasicConstraintsCA = &quot;2.5.29.19={critical}{text}CA=1&quot; # Basic Constraints: CA = True\n$ExtendedKeyUsageCA = &quot;2.5.29.37={text}&quot;               # Extended Key Usage:\n$ExtendedKeyUsageCA += &quot;1.3.6.1.5.5.7.3.1,&quot;            # Server Authentication\n$ExtendedKeyUsageCA += &quot;1.3.6.1.5.5.7.3.2,&quot;            # Client Authentication\n$ExtendedKeyUsageCA += &quot;1.3.6.1.5.5.7.3.3,&quot;            # Code Signing\n$ExtendedKeyUsageCA += &quot;1.3.6.1.5.5.7.3.4,&quot;            # Secure Email (SMIME)\n$ExtendedKeyUsageCA += &quot;1.3.6.1.5.5.7.3.8,&quot;            # Timestamp Signing\n$ExtendedKeyUsageCA += &quot;1.3.6.1.4.1.311.20.2.2&quot;        # Smartcard Logon\n\n# Ein CA-Zertifikat erzeugen, im Windows CertStore des Benutzers ablegen\n$myCA = New-SelfSignedCertificate -Type Custom `\n  -Subject &quot;CN=HITCo Certificate Authority - Demo-CA, OU=PKI, O=HITCo.at, C=AT&quot; `\n  -KeyAlgorithm ECDSA_secp384r1 -HashAlgorithm SHA384 `\n  -TextExtension @( $BasicConstraintsCA, $ExtendedKeyUsageCA ) `\n  -KeyUsage CertSign, CRLSign, DigitalSignature `\n  -NotBefore &quot;01.01.2026 12:00:00&quot; -NotAfter &quot;31.12.2040 12:00:00&quot; `\n  -KeyExportPolicy Exportable -CertStoreLocation &quot;Cert:\\CurrentUser\\My&quot;\n\n# Das Zertifikat inkl. Private Key in ein PFX = P12\/PKCS12 File sichern\n$myPassword = ConvertTo-SecureString -String &#039;myPassword&#039; -Force -AsPlainText\n$MyCaPfxFile = $MyCA | Export-PfxCertificate -FilePath C:\\Temp\\MyCA.pfx -Password $myPassword\n\n# Das Zertifikat (ohne Private Key) in eine CRT-Datei exportieren\n$myCAfile = $MyCA | Export-Certificate -FilePath C:\\Temp\\MyCA.crt -Type CERT\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Abweichend von den von mir hier zusammengestellten Code-Zeilen ist f\u00fcr den jeweiligen konkreten Bedarf anzupassen: Die Subject-Strings und eventuell der G\u00fcltigkeitszeitraum.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ich habe einen modernen ECDSA Algorithmus mit NIST P-384 Elliptic Curve gew\u00e4hlt. Wer lieber traditionell mit RSA arbeitet, kann die Parameter entsprechend anpassen.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Der relevante Teil diese Code-Zeilen liegt in der Zusammenstellung der BasicConstraints (das Zertifikat muss mit &#8222;CA = true&#8220; ausgestellt werden), sowie in der Zusammenstellung der passenden Extended Key Usages, f\u00fcr welche das CA-Zertifikat sich anschlie\u00dfend eignen soll. Die meisten OIDs k\u00f6nnen der <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/pki\/new-selfsignedcertificate\" target=\"_blank\" rel=\"noopener\">Microsoft Dokumentation<\/a> entnommen werden, fehlendes l\u00e4sst sich mit Recherche rasch ermitteln. Meine Zusammenstellung d\u00fcrfte f\u00fcr die allermeisten UseCases (jedenfalls aber f\u00fcr die von mir hier nachfolgend skizzierten) geeignet sein.   <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Das exportierte MyCA.pfx enth\u00e4lt auch den Private-Key und dient als Backup der CA. Dieses gemeinsam mit dem f\u00fcr den Export gew\u00e4hlten Passwort sicher verwahren.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">F\u00fcr die Verteilung der CA dient die exportierte CRT-Datei des Zertifikats (ohne PrivateKey). Diese CRT-Datei kann nun auf allen Ger\u00e4ten auf denen diese getrustet werden soll importiert werden. Das erfolgt z.B. wie folgt: Entweder als Administrator in den Maschinen-Zertifikats-Store, oder als Benutzer in den User-Zertifikats-Store:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; highlight: [1,4]; title: ; notranslate\" title=\"\">\n# a) CA tusten: Als Administrator in den Maschinen Store Vertrauensw\u00fcrdige Stammzertifikate importieren:\nImport-Certificate -FilePath &quot;C:\\Temp\\MyCA.crt&quot; -CertStoreLocation &#039;Cert:\\LocalMachine\\Root\\&#039;\n\n# b) CA trusten: Alternativ als Benutzer (ohne Administrator-Rechte) in den User-Store:\nImport-Certificate -FilePath &quot;C:\\Temp\\MyCA.crt&quot; -CertStoreLocation &#039;Cert:\\CurrentUser\\Root\\&#039;\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">Sichtpr\u00fcfung des Root-CA-Zertifikats<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Noch eine Sichtpr\u00fcfung mittels Windows-Zertifikatsverwaltung:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA.png\"><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"516\" src=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA.png\" alt=\"\" class=\"wp-image-2732\" srcset=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA.png 811w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-300x191.png 300w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-767x488.png 767w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-79x50.png 79w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Sowie noch eine optionale Sichtpr\u00fcfung mittels OpenSSL:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; highlight: [1]; title: ; notranslate\" title=\"\">\n# Sichtpr\u00fcfung mit OpenSSL\nopenssl x509 -in &quot;C:\\Temp\\MyCA.crt&quot; -noout -text &gt;&quot;C:\\Temp\\MyCA.txt&quot;\n\ntype &quot;C:\\Temp\\MyCA.txt&quot;\n...\n        Signature Algorithm: ecdsa-with-SHA384\n...\n        Validity\n            Not Before: Jan  1 10:00:00 2026 GMT\n            Not After : Dec 31 10:00:00 2040 GMT\n        Subject: C=AT, O=HITCo.at, OU=PKI, CN=HITCo Certificate Authority - Demo-CA\n...\n        X509v3 extensions:\n            X509v3 Key Usage: critical\n                Digital Signature, Certificate Sign, CRL Sign\n            X509v3 Basic Constraints: critical\n                CA:TRUE\n            X509v3 Extended Key Usage:\n                TLS Web Server Authentication, TLS Web Client Authentication, \n                Code Signing, E-mail Protection, Time Stamping, Microsoft Smartcard Login\n...\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Wir haben somit ein modernes CA-Root-Zertifikat (Basic Constraints: CA = True) mit 14 Jahren G\u00fcltigkeit erstellt, welches sich in Folge zur Ausstellung all unserer angedachten Zertifikats-Verwendungszwecke eignet.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Code-Signing-Zertifikat<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Wir stellen uns nun aus der soeben generierten Root-CA ein Authenticode-Signing-Zertifikat aus. Dieses dient der Signatur von Executables, Makro-Code, PowerShell-Scripts, Catalog-Files, u.v.m<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; highlight: [1,5,10,19,23,26]; title: ; notranslate\" title=\"\">\n# Das CA-Zertifikat f\u00fcr die Erstellung lokalisieren\n$caSubject = &quot;*HITCo Certificate Authority - Demo-CA*&quot;\n$caCert = Get-ChildItem -Path &quot;Cert:\\CurrentUser\\My&quot; | Where-Object { $_.Subject -like $caSubject } | Select-Object -First 1\n\n# Die TextExtension des Code-Signing-Zertifikats vorbereiten\n$BasicConstraints = &quot;2.5.29.19={critical}{text}CA=0&quot; # Basic Constraints: CA = false (Leaf-Certificate)\n$ExtendedKeyUsageCodeSigning =  &quot;2.5.29.37={text}&quot;   # Extended Key Usage:\n$ExtendedKeyUsageCodeSigning += &quot;1.3.6.1.5.5.7.3.3&quot;  # Code Signing\n\n# Zertifikat erstellen, mittels &quot;Signer&quot; w\u00e4hlt man das CA-Zertifikat, sodass es sich nicht um ein SelfSignedCertificate handelt\n$myCodeSigningCert = New-SelfSignedCertificate -Type Custom `\n  -Subject &quot;CN=HITCo Demo-Authenticode-Signer, OU=Dev-Department, O=HITCo.at, C=AT&quot; `\n  -Signer $caCert -KeyAlgorithm ECDSA_secp384r1 -HashAlgorithm SHA384 `\n  -TextExtension @( $BasicConstraints, $ExtendedKeyUsageCodeSigning ) `\n  -KeyUsage DigitalSignature `\n  -NotBefore &quot;01.01.2026 12:00:00&quot; -NotAfter  &quot;31.12.2035 12:00:00&quot; `\n  -KeyExportPolicy Exportable -CertStoreLocation &quot;Cert:\\CurrentUser\\My&quot;\n\n# Das Zertifikat inkl. Private Key in ein PFX = P12\/PKCS12 File sichern\n$myPassword = ConvertTo-SecureString -String &#039;myPassword&#039; -Force -AsPlainText\n$myCertPFXfile = $myCodeSigningCert | Export-PfxCertificate -FilePath C:\\Temp\\MyCodeSigningCert.pfx -Password $myPassword\n\n# Das Zertifikat (ohne Private Key) in eine CRT-Datei exportieren\n$myCertfile = $myCodeSigningCert | Export-Certificate -FilePath C:\\Temp\\MyCodeSigningCert.crt -Type CERT\n\n# Das Zertifikat eventuell als Trusted Publisher = Vertrauensw\u00fcrdiger Herausgeber im Machine Store hinterlegen \nImport-Certificate -FilePath &quot;C:\\Temp\\MyCodeSigningCert.crt&quot; -CertStoreLocation &#039;Cert:\\LocalMachine\\TrustedPublisher\\&#039;\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Abweichend von den von mir hier zusammengestellten Code-Zeilen ist f\u00fcr den jeweiligen konkreten Bedarf anzupassen: Der Name des CA-Zertifikats, das zur Ausstellung verwendet werden soll, sowie das Subject des zu erstellenden Code-Signing-Zertifikats.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Der Import des Code-Signing-Zertifikats in den Trusted Publisher Store der Maschine ist unter Windows nur in bestimmten Szenarien n\u00f6tig. F\u00fcr das signieren von EXE-, DLL-, PowerShell- &amp; Catalog-Files, etc &#8230; ist das in der Regel nicht erforderlich. Um aber zum Beispiel das Zertifikat zum Trusten f\u00fcr AppLocker-Policies zu verwenden, oder Treiber damit zu signieren ist dieser Schritt (optional) durchzuf\u00fchren.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Werfen wir einen Blick auf dieses Zertifikat, Sichtpr\u00fcfung:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-CodeSigning.png\"><img loading=\"lazy\" decoding=\"async\" width=\"809\" height=\"515\" src=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-CodeSigning.png\" alt=\"\" class=\"wp-image-2740\" srcset=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-CodeSigning.png 809w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-CodeSigning-300x191.png 300w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-CodeSigning-767x488.png 767w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-CodeSigning-79x50.png 79w\" sizes=\"auto, (max-width: 809px) 100vw, 809px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">TLS-WebServer Zertifikat mit Wildcard *.hitco.at<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Nun stellen wir uns ein TLS-WebServer-Zertifikat mitWildcard-Subject-Alternative-Name aus.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; highlight: [1,5,10,20,24]; title: ; notranslate\" title=\"\">\n# Das CA-Zertifikat f\u00fcr die Erstellung lokalisieren\n$caSubject = &quot;*HITCo Certificate Authority - Demo-CA*&quot;\n$caCert = Get-ChildItem -Path &quot;Cert:\\CurrentUser\\My&quot; | Where-Object { $_.Subject -like $caSubject } | Select-Object -First 1\n\n# Die TextExtension des TLS-WebServer-Zertifikats vorbereiten\n$BasicConstraints = &quot;2.5.29.19={critical}{text}CA=0&quot; # Basic Constraints: CA = false (Leaf-Certificate)\n$ExtendedKeyUsageTLS =  &quot;2.5.29.37={text}&quot;           # Extended Key Usage:\n$ExtendedKeyUsageTLS += &quot;1.3.6.1.5.5.7.3.1,&quot;         # Server Authentication\n\n# Zertifikat erstellen, mittels &quot;Signer&quot; w\u00e4hlt man das CA-Zertifikat, sodass es sich nicht um ein SelfSignedCertificate handelt\n$myServerCert = New-SelfSignedCertificate -Type Custom `\n  -Subject &quot;CN=HITCo.at WebServer, OU=Server-Department, O=HITCo.at, C=AT&quot; `\n  -DnsName &quot;hitco.at&quot;, &quot;*.hitco.at&quot; `\n  -Signer $caCert -KeyAlgorithm ECDSA_secp384r1 -HashAlgorithm SHA384 `\n  -TextExtension @( $BasicConstraints, $ExtendedKeyUsageTLS ) `\n  -KeyUsage DigitalSignature, KeyEncipherment `\n  -NotBefore &quot;01.01.2026 12:00:00&quot; -NotAfter  &quot;31.12.2035 12:00:00&quot; `\n  -KeyExportPolicy Exportable -CertStoreLocation &quot;Cert:\\CurrentUser\\My&quot;\n\n# Das Zertifikat inkl. Private Key in ein PFX = P12\/PKCS12 File sichern\n$myPassword = ConvertTo-SecureString -String &#039;myPassword&#039; -Force -AsPlainText\n$myCertPFXfile = $myServerCert | Export-PfxCertificate -FilePath &quot;C:\\Temp\\MyServerCert.pfx&quot; -Password $myPassword\n\n# Das Zertifikat (ohne Private Key) in eine CRT-Datei exportieren\n$myCertfile = $myServerCert | Export-Certificate -FilePath &quot;C:\\Temp\\MyServerCert.crt&quot; -Type CERT\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Abweichend von den von mir hier zusammengestellten Code-Zeilen ist f\u00fcr den jeweiligen konkreten Bedarf anzupassen: Der Name des CA-Zertifikats, das zur Ausstellung verwendet werden soll, sowie das Subject des neuen TLS-WebServer-Zertifikats und die Liste der Subject-Alternative-Names (DNSName).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Werfen wir einen Blick auf dieses Zertifikat, Sichtpr\u00fcfung:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-TLS-WebServer.png\"><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"515\" src=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-TLS-WebServer.png\" alt=\"\" class=\"wp-image-2743\" srcset=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-TLS-WebServer.png 811w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-TLS-WebServer-300x191.png 300w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-TLS-WebServer-767x487.png 767w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-TLS-WebServer-79x50.png 79w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/a><\/figure>\n\n\n\n<h1 class=\"wp-block-heading\">Benutzer-Zertifikat f\u00fcr E-Mail-Signatur\/Verschl\u00fcsselung, TLS-Client-Authentifizierung, Smartcard-Anmeldung<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Nun widmen wir uns der Ausstellung eines Benutzer-Zertifikats, welches sich nicht nur f\u00fcr die S\/MIME Verschl\u00fcsselung und Signatur von E-Mails nutzen lassen soll, sondern auch zur TLS-Client-Authentifizierung gegen\u00fcber WebServern und zur Smartcard-Anmeldung z.B. an ein Windows-System verwendet werden kann.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; highlight: [1,5,14,23,27]; title: ; notranslate\" title=\"\">\n# Das CA-Zertifikat f\u00fcr die Erstellung lokalisieren\n$caSubject = &quot;*HITCo Certificate Authority - Demo-CA*&quot;\n$caCert = Get-ChildItem -Path &quot;Cert:\\CurrentUser\\My&quot; | Where-Object { $_.Subject -like $caSubject } | Select-Object -First 1\n\n# Die TextExtension des Benutzer-Zertifikats vorbereiten\n$BasicConstraints = &quot;2.5.29.19={critical}{text}CA=0&quot; # Basic Constraints: CA = false (Leaf-Certificate)\n$ExtendedKeyUsageUser =  &quot;2.5.29.37={text}&quot;          # Extended Key Usage:\n$ExtendedKeyUsageUser += &quot;1.3.6.1.5.5.7.3.2,&quot;        # Client Authentication\n$ExtendedKeyUsageUser += &quot;1.3.6.1.5.5.7.3.4,&quot;        # Secure Email (SMIME)\n$ExtendedKeyUsageUser += &quot;1.3.6.1.4.1.311.20.2.2&quot;    # Smartcard Logon\n$SubjectAltNamesUser  =  &quot;2.5.29.17={text}&quot;          # E-Mail-Addresses and UserPrincipalNames\n$SubjectAltNamesUser  += &quot;email=max.mustermann@hitco.at&amp;upn=max.mustermann@hitco.at&quot;\n\n# Zertifikat erstellen, mittels &quot;Signer&quot; w\u00e4hlt man das CA-Zertifikat, sodass es sich nicht um ein SelfSignedCertificate handelt\n$myUserCert = New-SelfSignedCertificate -Type Custom `\n  -Subject &quot;CN=Max Mustermann, OU=HR-Department, O=HITCo.at, C=AT&quot; `\n  -Signer $caCert -KeyAlgorithm ECDSA_secp384r1 -HashAlgorithm SHA384 `\n  -TextExtension @( $BasicConstraints, $ExtendedKeyUsageUser, $SubjectAltNamesUser ) `\n  -KeyUsage DigitalSignature, KeyEncipherment, DataEncipherment `\n  -NotBefore &quot;01.01.2026 12:00:00&quot; -NotAfter  &quot;31.12.2035 12:00:00&quot; `\n  -KeyExportPolicy Exportable -CertStoreLocation &quot;Cert:\\CurrentUser\\My&quot;\n\n# Das Zertifikat inkl. Private Key in ein PFX = P12\/PKCS12 File sichern\n$myPassword = ConvertTo-SecureString -String &#039;myPassword&#039; -Force -AsPlainText\n$myCertPFXfile = $myUserCert | Export-PfxCertificate -FilePath &quot;C:\\Temp\\MyUserCert.pfx&quot; -Password $myPassword\n\n# Das Zertifikat (ohne Private Key) in eine CRT-Datei exportieren\n$myCertfile = $myUserCert | Export-Certificate -FilePath &quot;C:\\Temp\\MyUserCert.crt&quot; -Type CERT\n<\/pre><\/div>\n\n\n<p class=\"wp-block-paragraph\">Abweichend von den von mir hier zusammengestellten Code-Zeilen ist f\u00fcr den jeweiligen konkreten Bedarf anzupassen: Der Name des CA-Zertifikats, das zur Ausstellung verwendet werden soll, das Subject des neuen Benutzer-Zertifikats und die Liste der Subject-Alternative-Names (E-Mail-Adressen und eventuell der User-Principal-Name zur Dom\u00e4nen-Anmeldung).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Werfen wir einen Blick auf dieses Zertifikat, Sichtpr\u00fcfung:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME.png\"><img loading=\"lazy\" decoding=\"async\" width=\"811\" height=\"580\" src=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME.png\" alt=\"\" class=\"wp-image-2748\" srcset=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME.png 811w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-300x215.png 300w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-80x57.png 80w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-768x549.png 768w\" sizes=\"auto, (max-width: 811px) 100vw, 811px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Test mit Thunderbird<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Und noch ein abschlie\u00dfender Test der Nutzung des S\/MIME-Zertifikats mittels Thunderbird. Gepr\u00fcft wurde E-Mail-Verschl\u00fcsselung und Signatur. Hierzu muss zuerst das CA-Zertifikat in Thunderbird importiert und f\u00fcr den Verwendungszweck getrustet werden:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-Thunderbird-Test.png\"><img loading=\"lazy\" decoding=\"async\" width=\"741\" height=\"361\" src=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-Thunderbird-Test.png\" alt=\"\" class=\"wp-image-2752\" srcset=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-Thunderbird-Test.png 741w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-Thunderbird-Test-300x146.png 300w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-RootCA-Thunderbird-Test-78x38.png 78w\" sizes=\"auto, (max-width: 741px) 100vw, 741px\" \/><\/a><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Anschlie\u00dfend kann das Benutzer-Zertifikat (PFX-Datei) in Thunderbird importiert, konfiguriert und benutzt werden. Das Resultat f\u00e4llt positiv aus:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-Thunderbird-Test.png\"><img loading=\"lazy\" decoding=\"async\" width=\"451\" height=\"391\" src=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-Thunderbird-Test.png\" alt=\"\" class=\"wp-image-2753\" srcset=\"https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-Thunderbird-Test.png 451w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-Thunderbird-Test-300x260.png 300w, https:\/\/hitco.at\/blog\/wp-content\/uploads\/CA-PowerShell-UserCert-SMIME-Thunderbird-Test-80x69.png 80w\" sizes=\"auto, (max-width: 451px) 100vw, 451px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>R\u00fcckblick: Vor ein paar Jahren habe ich unter S\/MIME-Zertifikate mittels klickfertiger OpenSSL-CA selbst erstellen erl\u00e4utert, wie mittels ein paar Scripts basierend auf OpenSSL eine Certificate Authority (CA) instanziiert und zur Zertifikatsausstellung genutzt wird. Mit diesem Blog-Post hier demonstriere ich, wie unter Verwendung von Windows 11 Bordmitteln (Powershell, es wird kein OpenSSL ben\u00f6tigt) eine CA erstellt und daraus Code-Signing-Zertifikate, Webserver-Zertifikate, Benutzer-Zertifikate&#8230; <\/p>\n","protected":false},"author":1,"featured_media":2732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[3,4,5,23],"tags":[634,503,630,502,217,500,640,499,632,633,173],"class_list":["post-2723","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-it","category-security","category-smartcards","category-windows","tag-authenticode-signing","tag-ca","tag-certificate-authority","tag-openssl","tag-powershell","tag-s-mime","tag-smartcard-zertifikat","tag-smime","tag-tls-client-authentication","tag-wildcard-zertifikate","tag-windows"],"_links":{"self":[{"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/posts\/2723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/comments?post=2723"}],"version-history":[{"count":39,"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/posts\/2723\/revisions"}],"predecessor-version":[{"id":2792,"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/posts\/2723\/revisions\/2792"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/media\/2732"}],"wp:attachment":[{"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/media?parent=2723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/categories?post=2723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hitco.at\/blog\/wp-json\/wp\/v2\/tags?post=2723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}