-
Notifications
You must be signed in to change notification settings - Fork 205
(#1074) Add docs for Assert-ValidChecksum #1075
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
Draft
vexx32
wants to merge
2
commits into
chocolatey:master
Choose a base branch
from
vexx32:Assert-ValidChecksum.docs
base: master
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.
+169
−159
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
164 changes: 164 additions & 0 deletions
164
src/content/docs/en-us/create/cmdlets/Assert-ValidChecksum.mdx
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,164 @@ | ||
--- | ||
description: Information on Assert-ValidChecksum cmdlet | ||
external help file: Chocolatey.PowerShell.dll-Help.xml | ||
Module Name: Chocolatey.PowerShell | ||
online version: https://docs.chocolatey.org/en-us/create/cmdlets/assert-validchecksum | ||
order: 20 | ||
schema: 2.0.0 | ||
title: Assert-ValidChecksum | ||
xref: assert-validchecksum | ||
--- | ||
import Xref from '@components/Xref.astro'; | ||
|
||
# Assert-ValidChecksum | ||
|
||
## SYNOPSIS | ||
Checks a file's checksum versus a passed checksum and checksum type. | ||
|
||
## SYNTAX | ||
|
||
``` | ||
Assert-ValidChecksum [-Path] <String> [[-Checksum] <String>] [[-ChecksumType] <ChecksumType>] [[-Url] <String>] | ||
[-IgnoredArguments <Object[]>] [<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
|
||
Makes a determination if a file meets an expected checksum signature. | ||
This function is usually used when comparing a file that is downloaded from an official distribution point. | ||
If the checksum fails to match the expected output, this function throws an error. | ||
|
||
Checksums have been used for years as a means of verification. A checksum hash is a unique value or signature that corresponds to the contents of a file. | ||
File names and extensions can be altered without changing the checksum signature. | ||
However if you changed the contents of the file, even one character, the checksum will be different. | ||
|
||
Checksums are used to provide as a means of cryptographically ensuring the contents of a file have not been changed. | ||
While some cryptographic algorithms, including MD5 and SHA1, are no longer considered secure against attack, the goal of a checksum algorithm is to make it extremely difficult (near impossible with better algorithms) to alter the contents of a file (whether by accident or for malicious reasons) and still result in the same checksum signature. | ||
|
||
When verifying a checksum using a secure algorithm, if the checksum matches the expected signature, the contents of the file are identical to what is expected. | ||
|
||
## EXAMPLES | ||
|
||
### Example 1 | ||
```powershell | ||
PS C:\> Assert-ValidChecksum -Path $fileFullPath -Checksum $checksum -ChecksumType $checksumType | ||
``` | ||
|
||
Calculates the `$checksumType` checksum of the file at `$fileFullPath` and compares it to the provided `$checksum` value. | ||
If the checksums do not match, or the `checksum.exe` is missing, this will throw an error. | ||
|
||
## PARAMETERS | ||
|
||
### -Checksum | ||
The checksum value that the file is expected to match. | ||
|
||
```yaml | ||
Type: String | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: False | ||
Position: 1 | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -ChecksumType | ||
The type of checksum algorithm to use. | ||
|
||
```yaml | ||
Type: ChecksumType | ||
Parameter Sets: (All) | ||
Aliases: | ||
Accepted values: Md5, Sha1, Sha256, Sha512 | ||
|
||
Required: False | ||
Position: 2 | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -IgnoredArguments | ||
Allows splatting with arguments that do not apply. Do not use directly. | ||
|
||
```yaml | ||
Type: Object[] | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: False | ||
Position: Named | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -Path | ||
The path to the file to verify the checksum for. | ||
|
||
```yaml | ||
Type: String | ||
Parameter Sets: (All) | ||
Aliases: File, FilePath | ||
|
||
Required: True | ||
Position: 0 | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### -Url | ||
The original URL that the file was downloaded from, if any. | ||
This is primarily for internal use, and will only matter if certain Chocolatey CLI features are enabled and there is no `-Checksum` value provided. | ||
|
||
```yaml | ||
Type: String | ||
Parameter Sets: (All) | ||
Aliases: OriginalUrl | ||
|
||
Required: False | ||
Position: 3 | ||
Default value: None | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
|
||
### CommonParameters | ||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
|
||
## INPUTS | ||
|
||
## OUTPUTS | ||
|
||
## NOTES | ||
This uses the checksum.exe tool available separately at https://community.chocolatey.org/packages/checksum. | ||
|
||
Chocolatey CLI options that affect checksum verification: | ||
|
||
- `--ignore-checksums` - skips checksumming | ||
- `--allow-empty-checksums` - skips checksumming when the package is missing a checksum | ||
- `--allow-empty-checksums-secure` - skips checksumming when the package is missing a checksum for secure (HTTPS) locations | ||
- `--require-checksums` - requires checksums for both non-secure and secure locations | ||
- `--download-checksum`, `--download-checksum-type` - allows user to pass their own checksums | ||
- `--download-checksum-x64`, `--download-checksum-type-x64` - allows user to pass their own checksums | ||
|
||
Chocolatey CLI features that affect checksum verification: | ||
|
||
- `checksumFiles` - when turned off, skips checksumming | ||
- `allowEmptyChecksums` - when turned on, skips checksumming when the package is missing a checksum | ||
- `allowEmptyChecksumsSecure` - when turned on, skips checksumming when the package is missing a checksum for secure (HTTPS) locations | ||
|
||
This command is also aliased to `Get-ChecksumValid` for compatibility with packages designed for Chocolatey CLI v2.x and earlier. | ||
|
||
## RELATED LINKS | ||
|
||
<Xref title="Get-ChocolateyWebFile" value="get-chocolateywebfile" classes="mb-3 d-block" /> | ||
|
||
<Xref title="Install-ChocolateyPackage" value="install-chocolateypackage" classes="mb-3 d-block" /> | ||
|
||
<Xref title="Cmdlet Reference" value="powershell-cmdlet-reference" classes="mb-3 d-block" /> | ||
|
||
<Xref title="Function Reference" value="powershell-reference" /> |
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
156 changes: 0 additions & 156 deletions
156
src/content/docs/en-us/create/functions/get-checksumvalid.mdx
This file was deleted.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.