-
-
Notifications
You must be signed in to change notification settings - Fork 171
Add Windows Authenticode code signing support for Smart App Control compatibility #240
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
Open
Copilot
wants to merge
8
commits into
main
Choose a base branch
from
copilot/fix-164
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
298df02
Initial plan
Copilot befc2f4
Initial assessment: Add code signing support for Windows 11 Smart Appβ¦
Copilot 2d2a71d
Add Windows Authenticode code signing support for Smart App Control cβ¦
Copilot 0cbb2b2
Add code signing documentation to README
Copilot c48548e
Merge branch 'main' into copilot/fix-164
TheCodeTraveler 5beed3e
Update azure-pipelines.yml
TheCodeTraveler 568bfd6
Update src/AsyncAwaitBestPractices/AsyncAwaitBestPractices.csproj
TheCodeTraveler 87f087e
Update src/AsyncAwaitBestPractices.MVVM/AsyncAwaitBestPractices.MVVM.β¦
TheCodeTraveler File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# Code Signing Configuration | ||
|
||
## Overview | ||
|
||
AsyncAwaitBestPractices supports Windows Authenticode code signing to ensure compatibility with Windows 11 Smart App Control. This feature helps prevent the security warnings that occur when Smart App Control is enabled. | ||
|
||
## How It Works | ||
|
||
### Build Process | ||
- Code signing is automatically enabled during Release builds when running on Windows | ||
- Signing occurs after the build completes for each target framework | ||
- The signing process is conditional and won't break builds when certificates are not available | ||
|
||
### Requirements | ||
- Valid Windows code signing certificate (`.pfx` file) | ||
- `signtool.exe` available in PATH (included with Windows SDK) | ||
- Windows build environment (signing is skipped on other platforms) | ||
|
||
## Configuration | ||
|
||
### Environment Variables | ||
Set these environment variables to enable code signing: | ||
|
||
```bash | ||
WINDOWS_CODESIGN_CERTIFICATE=path/to/your/certificate.pfx | ||
WINDOWS_CODESIGN_PASSWORD=your-certificate-password | ||
``` | ||
|
||
### MSBuild Properties | ||
Alternatively, you can set these MSBuild properties: | ||
|
||
```xml | ||
<PropertyGroup> | ||
<CodeSigningCertificatePath>path/to/your/certificate.pfx</CodeSigningCertificatePath> | ||
<CodeSigningCertificatePassword>your-certificate-password</CodeSigningCertificatePassword> | ||
<CodeSigningTimestampServer>http://timestamp.digicert.com</CodeSigningTimestampServer> | ||
</PropertyGroup> | ||
``` | ||
|
||
## Azure DevOps Pipeline | ||
|
||
The Azure DevOps pipeline is configured to automatically sign assemblies when: | ||
1. A secure file named by `WINDOWS_CODESIGN_CERTIFICATE_NAME` variable is available | ||
2. The `WINDOWS_CODESIGN_PASSWORD` variable is set | ||
3. The build is running on Windows | ||
|
||
### Pipeline Setup | ||
1. Upload your code signing certificate as a secure file in Azure DevOps | ||
2. Set the `WINDOWS_CODESIGN_CERTIFICATE_NAME` variable to the name of your secure file | ||
3. Set the `WINDOWS_CODESIGN_PASSWORD` variable as a secret variable | ||
|
||
## Certificate Requirements | ||
|
||
### For Windows 11 Smart App Control | ||
- Certificate must be issued by a trusted Certificate Authority | ||
- Certificate must be valid for code signing | ||
- Certificate should have timestamping enabled for long-term validity | ||
|
||
### Recommended Certificate Authorities | ||
- DigiCert | ||
- Sectigo (formerly Comodo) | ||
- GlobalSign | ||
- Entrust | ||
|
||
## Troubleshooting | ||
|
||
### Common Issues | ||
- **Certificate not found**: Ensure the certificate path is correct and the file exists | ||
- **Invalid password**: Verify the certificate password is correct | ||
- **Timestamp server unavailable**: The build will retry timestamping, or you can change the timestamp server URL | ||
- **signtool not found**: Install Windows SDK or ensure signtool.exe is in your PATH | ||
|
||
### Local Development | ||
Code signing is disabled by default for local development. To test signing locally: | ||
1. Obtain a code signing certificate | ||
2. Set the required environment variables | ||
3. Build in Release configuration on Windows | ||
|
||
## Security Considerations | ||
|
||
- **Never commit certificates to source control** | ||
- **Use secure storage for certificates and passwords** | ||
- **Regularly update certificates before expiration** | ||
- **Use separate certificates for different environments if needed** | ||
|
||
## Verification | ||
|
||
### Checking if an Assembly is Signed | ||
You can verify if an assembly is signed using: | ||
|
||
```powershell | ||
# PowerShell | ||
Get-AuthenticodeSignature "AsyncAwaitBestPractices.dll" | ||
|
||
# Command Prompt | ||
signtool verify /pa "AsyncAwaitBestPractices.dll" | ||
``` | ||
|
||
### Properties Dialog | ||
Right-click the DLL file and select "Properties" β "Digital Signatures" tab to view signature information. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The recommended Certificate Authorities section should include more context about why these specific CAs are recommended for Windows code signing and Smart App Control compatibility.
Copilot uses AI. Check for mistakes.