Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The certificate cannot be verified during Windows 10 system installation #2313

Closed
zeckwan opened this issue Dec 23, 2024 · 1 comment
Closed

Comments

@zeckwan
Copy link

zeckwan commented Dec 23, 2024

How frequently does the bug occur?

Always

Description

图片

Stacktrace & log output

No response

Can you reproduce the bug?

No

Reproduction Steps

No response

Version

1184

OS

windows10

@CompileFuture2024 CompileFuture2024 changed the title windows10系统安装时无法验证证书 The certificate cannot be verified during Windows 10 system installation Dec 23, 2024
@guiyanakuang
Copy link
Member

guiyanakuang commented Dec 23, 2024

Thank you for your interest! You can install through either of these methods:

  1. Download from Microsoft Store:
    https://apps.microsoft.com/detail/9p6x7d7dmccr

  2. Install using the install.ps1 script or crosspaste.exe (if GitHub cannot be accessed directly, you need to provide a proxy for the installation process)

  3. Download and extract the compressed version crosspaste-xxx-windows-amd64.zip

Note regarding the Microsoft Store version: As this is open source software, I haven't purchased a code signing certificate (which costs around $400 annually), hence both installation options are provided.

Actually, install.ps1 installs through crosspaste.appinstaller. If installing manually, you need to install the certificate in advance, just like the script does.

# Generated by Hydraulic Conveyor: https://www.hydraulic.dev
# Startup script for self-signed MSIX packaged apps.

$CertName = "CN=85A51CE1-8911-4CD3-94A0-F98F4E742FED"
$FSName = "crosspaste"
$PackageName = "ShenzhenCompileFutureTech.CrossPaste"
$Site = "https://github.com/CrossPaste/crosspaste-desktop/releases/latest/download"


$CertURL = "${Site}/${FSName}.crt"

# Install the self-signed code signing cert, if necessary. Unfortunately, we can't install to the user-specific cert store, so we have to be admin.
# 1. Do we have it already?
if (!((dir cert:\LocalMachine\TrustedPeople).Subject -contains $CertName))
{
    # 2. No. Are we admin?
    if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
    {
        # No. So we have to elevate.
        Write-Output "Attempting to add root certificate ..."

        # 3. Write the cert to a temp file
        $cert = $Env:Temp + "\${FSName}.crt"
        Invoke-WebRequest -Uri "$CertURL" -OutFile $cert
        $cmd = "Import-Certificate -FilePath '$cert' -CertStoreLocation `"Cert:\LocalMachine\TrustedPeople`";Start-Sleep -s 2"

        # 4. Elevate to local admin and install the cert with that script.
        Start-Process powershell -ArgumentList "$cmd" -Wait -Verb runAs
    }
}

# Install the MSIX package (will show an ascii art progress bar).
# Although we could open the GUI AppInstaller app here, and that has some advantages, there's no way to force it to the foreground.
# Every attempt using Win32 fails, presumably because it's running elevated and windows UAC screws things up.
Add-AppxPackage -AppInstallerFile "${Site}/${FSName}.appinstaller"

start "shell:appsFolder\ShenzhenCompileFutureTech.CrossPaste_gphsk9mrjnczc!Crosspaste"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants