Skip to content

Commit 8e752de

Browse files
committed
6.1.4 — 12.08.2022
1 parent a1ee1f5 commit 8e752de

File tree

104 files changed

+12870
-13479
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+12870
-13479
lines changed

Scripts/Sign.ps1

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
cls
2+
# Sign all scripts in folder recursively by a self-signed certificate
3+
$CertName = "Sophia Project"
4+
$FolderPath = "D:\Sophia-Script-for-Windows\Sophia Script"
5+
$ExtensionsToSearchIn = @(".ps1", ".psm1", ".psd1")
6+
Get-ChildItem -Path Cert:\LocalMachine\My, Cert:\CurrentUser\My | Where-Object -FilterScript {$_.Subject -eq "CN=$CertName"} | Remove-Item
7+
8+
# Generate a self-signed Authenticode certificate in the local computer's personal certificate store
9+
$Parameters = @{
10+
Subject = $CertName
11+
NotAfter = (Get-Date).AddMonths(24)
12+
CertStoreLocation = "Cert:\LocalMachine\My"
13+
Type = "CodeSigningCert"
14+
}
15+
$authenticode = New-SelfSignedCertificate @Parameters
16+
17+
# Add the self-signed Authenticode certificate to the computer's root certificate store
18+
# Create an object to represent the LocalMachine\Root certificate store
19+
$rootStore = [System.Security.Cryptography.X509Certificates.X509Store]::new("Root","LocalMachine")
20+
# Open the root certificate store for reading and writing
21+
$rootStore.Open("ReadWrite")
22+
# Add the certificate stored in the $authenticode variable
23+
$rootStore.Add($authenticode)
24+
# Close the root certificate store
25+
$rootStore.Close()
26+
27+
# Add the self-signed Authenticode certificate to the computer's trusted publishers certificate store
28+
# Create an object to represent the LocalMachine\TrustedPublisher certificate store
29+
$publisherStore = [System.Security.Cryptography.X509Certificates.X509Store]::new("TrustedPublisher","LocalMachine")
30+
# Open the TrustedPublisher certificate store for reading and writing
31+
$publisherStore.Open("ReadWrite")
32+
# Add the certificate stored in the $authenticode variable
33+
$publisherStore.Add($authenticode)
34+
# Close the TrustedPublisher certificate store
35+
$publisherStore.Close()
36+
37+
# Get the code-signing certificate from the local computer's certificate store with the name "Sophia Authenticode" and store it to the $codeCertificate variable
38+
$codeCertificate = Get-ChildItem -Path Cert:\LocalMachine\My | Where-Object -FilterScript {$_.Subject -eq "CN=$CertName"}
39+
40+
# TimeStampServer specifies the trusted timestamp server that adds a timestamp to script's digital signature
41+
# Adding a timestamp ensures that your code will not expire when the signing certificate expires
42+
# -Include *.ps1, *.psm1, *.psd1 is obvious, but it's slow
43+
Get-ChildItem -Path $FolderPath -Recurse -File | Where-Object -FilterScript {$_.Extension -in $ExtensionsToSearchIn} | ForEach-Object -Process {
44+
$Parameters = @{
45+
FilePath = $_.FullName
46+
Certificate = $codeCertificate
47+
TimeStampServer = "http://timestamp.digicert.com"
48+
}
49+
Set-AuthenticodeSignature @Parameters
50+
}

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Functions.ps1

Lines changed: 134 additions & 135 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/de-DE/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/en-US/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/es-ES/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/fr-FR/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/hu-HU/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/it-IT/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/pt-BR/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

Sophia Script/Sophia Script for Windows 10 LTSC 2019/Localizations/ru-RU/Sophia.psd1

Lines changed: 129 additions & 130 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)