Benutzer:MovGP0/Zertifikate
Zur Navigation springen
Zur Suche springen
MovGP0 | Über mich | Hilfen | Artikel | Weblinks | Literatur | Zitate | Notizen | Programmierung | MSCert | Physik |
SSL Zertifikat generieren[Bearbeiten | Quelltext bearbeiten]
selfssl /N "cn=localhost;cn=example.com" /V "EXPIRATIONTIMEINDAYS" /I /S "IISSITENAME" /X /F "KEYLOCATION\key.pfx" /W "PASSWORD" /T
makecert -r -n "CN=localhost" -b 01/01/2000 -e 01/01/2099 -eku 1.3.6.1.5.5.7.3.3 -sv localhost.pvk localhost.cer
cert2spc localhost.cer localhost.spc
pvk2pfx -pvk localhost.pvk -spc localhost.spc -pfx localhost.pfx
Für ObjectIDs (EKU-Codes) siehe KB287547
openssl genrsa -out localhost.key 2048
openssl req -new -x509 -key localhost.key -out localhost.cert -days 3650 -subj /CN=localhost
# create root zertificate
$rootCert = New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my -DnsName "Root CA Name";
# export root certificate
[System.Security.SecureString]$rootcertPassword = ConvertTo-SecureString -String "znft5yeL34pxCu3nATlt1gMazX0NM8FVvr9yZOhcS79yJm8kUVjhA17UuWkQOb0u" -Force -AsPlainText;
[String]$rootCertPath = Join-Path -Path 'cert:\localMachine\my\' -ChildPath "$($rootcert.Thumbprint)";
Export-PfxCertificate -Cert $rootCertPath -FilePath 'root-authority.pfx' -Password $rootcertPassword; # private key
Export-Certificate -Cert $rootCertPath -FilePath 'root-authority.crt'; # public key
# use root certificate to sign gateway certificate
$gatewayCert = New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my -DnsName "*.example.com","*.example.org" -Signer $rootCert;
# export gateway certificate
[System.Security.SecureString]$gatewayCertPassword = ConvertTo-SecureString -String "Xc8FlsHq8hmLnKXk4AaD8ug6HYH2dpSWLjwg9eNeDIK103d3akbd0OccgZZ6bL48" -Force -AsPlainText;
[String]$gatewayCertPath = Join-Path -Path 'cert:\localMachine\my\' -ChildPath "$($gatewayCert.Thumbprint)";
Export-PfxCertificate -Cert $gatewayCertPath -FilePath gateway-certificate.pfx -Password $gatewayCertPassword; # private key
Export-Certificate -Cert $gatewayCertPath -FilePath gateway.crt; # public key
See also: Self-Signed Zertifikat für IIS [3][Bearbeiten | Quelltext bearbeiten]
Zertifikat öffnen und nach
Anschließend in IIS das Binding der Website ändern, so dass das neue Zertifikat verwendet wird.
Zertifikate für SharePoint[Bearbeiten | Quelltext bearbeiten]Zertifikaterstellung mit PowerShell[Bearbeiten | Quelltext bearbeiten]param(
[Parameter(Mandatory=$True)]
[string]$CertificateName
)
# paths
$ExeMakeCert = "$env:ProgramFiles\Microsoft Office Servers\15.0\Tools\makecert.exe"
$ExeCertManager = "$env:ProgramFiles\Microsoft Office Servers\15.0\Tools\certmgr.exe"
$CertPath = "$env:UserProfile\MyCertificates"
$CertName = $CertificateName + ".cer"
# create the certificate
$CertificateFullPath = Join-Path -Path $CertPath -ChildPath $CertName
& "$ExeMakeCert -replace -pe -ne ""CN=www.dirry.eu"" -b 01/01/2025 -e 01/01/2025 -ss my -sr -localMachineName -sky exchange -sp ""Microsof RSA SChannel Cryptographic Provider"" -sy 12 $CertificateFullPath"
# get certificate thumbprint
$AppCertificate = Get-PfxCertificate -FilePath $CertificateFullPath
# add certificate to local machine root
& "$ExeCertManager /add $CertificateFullPath /s /r localMachine root"
# export private key for certificate
Get-ChildItem cert:\\localmachine\my | Where-Object { $_.Thumbprint -eq $AppCertificate.Thumbprint } | ForEach-Object {
$CertPfxName = (Get-Item -Path $CertificateFullPath).BaseName
$CertPfxName += ".pfx"
$CertExportPath = Join-Path -Path $CertPath -ChildPath $CertPfxName
$CertFileByteArray = $_.Export("PFX", $CertPassword)
[System.IO.File]::WriteAllBytes($CertExportPath, $CertFileByteArray)
}
Import in web.config[Bearbeiten | Quelltext bearbeiten]<configuration>
<appSettings>
<add key="ClientId" value="223CFE50-182E-4C3C-A9B5-09BD4B55F404" />
<add key="ClientSigningCertificatePath" value="c:\...\MyCertificate.pfx" />
<add key="ClientSigningCertificatePassword" value="My T0p Secre7 Passw0rd" />
</appSettings>
</configuration>
Erstellung einer S2S STS[Bearbeiten | Quelltext bearbeiten]Erstellung einer Server-to-Server Security-Token-Service:
# get references to site's auth realm
$spweb = Get-SPWeb "http://sp.mydomain.com/"
$realm = Get-SPAuthenticationRealm -ServiceContext $spweb.Site
# if no App GUID was passed in, create one
if([string]::IsNullOrEmpty($AppGuid)) {
$AppGuid = [Guid]::NewGuid().ToString()
}
$fullAppIdentifier = $AppGuid + '@' + $realm
# get certificate
$certificate = Get-PfxCertificate $certificateFullPath
#register app vertificate as trusted by SharePoint site
$secureTokenIssuer = New-SPTrustedSecurityTokenIssuer -Name $AppDisplayName -Certificate $certificate -RegisteredIssuerName $fullAppIdentifier
#register app principal
$appPrincipal = Register-SPAppPrincipal -NameIdentifier $fullAppIdentifier -Site $spweb -DisplayName $AppDisplayName
SSL/TLS und X.509[Bearbeiten | Quelltext bearbeiten]Dateiformate[Bearbeiten | Quelltext bearbeiten]
Tools zum Verwalten von Zertifikaten[Bearbeiten | Quelltext bearbeiten]
siehe auch: PKI Client Cmdlets in Windows PowerShell. In: Technet. Microsoft, abgerufen am 27. August 2013. X.509 Attribute[Bearbeiten | Quelltext bearbeiten]
Internetquelle[Bearbeiten | Quelltext bearbeiten]
Einzelnachweise[Bearbeiten | Quelltext bearbeiten]
|