Skip to content

Commit 1be6113

Browse files
committed
(#1074) Add documentation for Assert-ValidChecksum
1 parent e6c7c17 commit 1be6113

File tree

4 files changed

+59
-188
lines changed

4 files changed

+59
-188
lines changed

astro.config.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ export default defineConfig({
209209
'/docs/CreatePackages': '/en-us/create/create-packages/',
210210
'/docs/helpers-format-file-size': '/en-us/create/functions/format-filesize/',
211211
'/docs/helpersformatfilesize': '/en-us/create/functions/format-filesize/',
212-
'/docs/helpers-get-checksum-valid': '/en-us/create/functions/get-checksumvalid/',
213-
'/docs/helpersgetchecksumvalid': '/en-us/create/functions/get-checksumvalid/',
212+
'/docs/helpers-get-checksum-valid': '/en-us/create/cmdlets/assert-validchecksum',
213+
'/docs/helpersgetchecksumvalid': '/en-us/create/cmdlets/assert-validchecksum',
214214
'/docs/helpers-get-chocolatey-config-value': '/en-us/create/functions/get-chocolateyconfigvalue/',
215215
'/docs/helpersgetchocolateyconfigvalue': '/en-us/create/functions/get-chocolateyconfigvalue/',
216216
'/docs/helpers-get-chocolatey-path': '/en-us/create/functions/get-chocolateypath/',
@@ -347,6 +347,7 @@ export default defineConfig({
347347
'/docs/roadmap': '/en-us/roadmap/',
348348
'/docs/troubleshooting': '/en-us/troubleshooting/',
349349
'/docs/why': '/en-us/why/',
350+
'/en-us/create/functions/get-checksumvalid/': '/en-us/create/cmdlets/assert-validchecksum',
350351
'/en-us/create/functions/get-environmentvariable': '/en-us/create/cmdlets/get-environmentvariable/',
351352
'/en-us/create/functions/get-environmentvariablenames': '/en-us/create/cmdlets/get-environmentvariablenames/',
352353
'/en-us/create/functions/install-chocolateypath': '/en-us/create/cmdlets/install-chocolateyPath/',

src/content/docs/en-us/create/cmdlets/Assert-ValidChecksum.mdx

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,56 @@
11
---
2+
description: Information on Assert-ValidChecksum cmdlet
23
external help file: Chocolatey.PowerShell.dll-Help.xml
34
Module Name: Chocolatey.PowerShell
4-
online version:
5+
online version: https://docs.chocolatey.org/en-us/create/cmdlets/assert-validchecksum
6+
order: 20
57
schema: 2.0.0
8+
title: Assert-ValidChecksum
9+
xref: assert-validchecksum
610
---
711
import Xref from '@components/Xref.astro';
812

913
# Assert-ValidChecksum
1014

1115
## SYNOPSIS
12-
{{ Fill in the Synopsis }}
16+
Checks a file's checksum versus a passed checksum and checksum type.
1317

1418
## SYNTAX
1519

1620
```
1721
Assert-ValidChecksum [-Path] <String> [[-Checksum] <String>] [[-ChecksumType] <ChecksumType>] [[-Url] <String>]
18-
[-IgnoredArguments <Object[]>] [-ProgressAction <ActionPreference>] [<CommonParameters>]
22+
[-IgnoredArguments <Object[]>] [<CommonParameters>]
1923
```
2024

2125
## DESCRIPTION
22-
{{ Fill in the Description }}
26+
27+
Makes a determination if a file meets an expected checksum signature.
28+
This function is usually used when comparing a file that is downloaded from an official distribution point.
29+
If the checksum fails to match the expected output, this function throws an error.
30+
31+
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.
32+
File names and extensions can be altered without changing the checksum signature.
33+
However if you changed the contents of the file, even one character, the checksum will be different.
34+
35+
Checksums are used to provide as a means of cryptographically ensuring the contents of a file have not been changed.
36+
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.
37+
38+
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.
2339

2440
## EXAMPLES
2541

2642
### Example 1
2743
```powershell
28-
PS C:\> {{ Add example code here }}
44+
PS C:\> Assert-ValidChecksum -Path $fileFullPath -Checksum $checksum -ChecksumType $checksumType
2945
```
3046

31-
{{ Add example description here }}
47+
Calculates the `$checksumType` checksum of the file at `$fileFullPath` and compares it to the provided `$checksum` value.
48+
If the checksums do not match, or the `checksum.exe` is missing, this will throw an error.
3249

3350
## PARAMETERS
3451

3552
### -Checksum
36-
{{ Fill Checksum Description }}
53+
The checksum value that the file is expected to match.
3754

3855
```yaml
3956
Type: String
@@ -48,7 +65,7 @@ Accept wildcard characters: False
4865
```
4966
5067
### -ChecksumType
51-
{{ Fill ChecksumType Description }}
68+
The type of checksum algorithm to use.
5269
5370
```yaml
5471
Type: ChecksumType
@@ -64,7 +81,7 @@ Accept wildcard characters: False
6481
```
6582
6683
### -IgnoredArguments
67-
{{ Fill IgnoredArguments Description }}
84+
Allows splatting with arguments that do not apply. Do not use directly.
6885
6986
```yaml
7087
Type: Object[]
@@ -79,7 +96,7 @@ Accept wildcard characters: False
7996
```
8097
8198
### -Path
82-
{{ Fill Path Description }}
99+
The path to the file to verify the checksum for.
83100
84101
```yaml
85102
Type: String
@@ -94,7 +111,8 @@ Accept wildcard characters: False
94111
```
95112
96113
### -Url
97-
{{ Fill Url Description }}
114+
The original URL that the file was downloaded from, if any.
115+
This is primarily for internal use, and will only matter if certain Chocolatey CLI features are enabled and there is no `-Checksum` value provided.
98116

99117
```yaml
100118
Type: String
@@ -108,31 +126,39 @@ Accept pipeline input: False
108126
Accept wildcard characters: False
109127
```
110128

111-
### -ProgressAction
112-
{{ Fill ProgressAction Description }}
113-
114-
```yaml
115-
Type: ActionPreference
116-
Parameter Sets: (All)
117-
Aliases: proga
118-
119-
Required: False
120-
Position: Named
121-
Default value: None
122-
Accept pipeline input: False
123-
Accept wildcard characters: False
124-
```
125-
126129
### CommonParameters
127130
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).
128131

129132
## INPUTS
130133

131-
### System.Object[]
132-
133134
## OUTPUTS
134135

135-
### System.Object
136136
## NOTES
137+
This uses the checksum.exe tool available separately at https://community.chocolatey.org/packages/checksum.
138+
139+
Chocolatey CLI options that affect checksum verification:
140+
141+
- `--ignore-checksums` - skips checksumming
142+
- `--allow-empty-checksums` - skips checksumming when the package is missing a checksum
143+
- `--allow-empty-checksums-secure` - skips checksumming when the package is missing a checksum for secure (HTTPS) locations
144+
- `--require-checksums` - requires checksums for both non-secure and secure locations
145+
- `--download-checksum`, `--download-checksum-type` - allows user to pass their own checksums
146+
- `--download-checksum-x64`, `--download-checksum-type-x64` - allows user to pass their own checksums
147+
148+
Chocolatey CLI features that affect checksum verification:
149+
150+
- `checksumFiles` - when turned off, skips checksumming
151+
- `allowEmptyChecksums` - when turned on, skips checksumming when the package is missing a checksum
152+
- `allowEmptyChecksumsSecure` - when turned on, skips checksumming when the package is missing a checksum for secure (HTTPS) locations
153+
154+
This command is also aliased to `Get-ChecksumValid` for compatibility with packages designed for Chocolatey CLI v2.x and earlier.
137155

138156
## RELATED LINKS
157+
158+
<Xref title="Get-ChocolateyWebFile" value="get-chocolateywebfile" classes="mb-3 d-block" />
159+
160+
<Xref title="Install-ChocolateyPackage" value="install-chocolateypackage" classes="mb-3 d-block" />
161+
162+
<Xref title="Cmdlet Reference" value="powershell-cmdlet-reference" classes="mb-3 d-block" />
163+
164+
<Xref title="Function Reference" value="powershell-reference" />

src/content/docs/en-us/create/functions/get-checksumvalid.mdx

Lines changed: 0 additions & 156 deletions
This file was deleted.

src/content/docs/en-us/create/functions/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ These are the functions from above as one list.
6464
## Complete List (alphabetical order)
6565

6666
* <Xref title='Format-FileSize' value='format-filesize' />
67-
* <Xref title='Get-ChecksumValid' value='get-checksumvalid' />
67+
* <Xref title='Get-ChecksumValid' value='assert-validchecksum' />
6868
* <Xref title='Get-ChocolateyConfigValue' value='get-chocolateyconfigvalue' />
6969
* <Xref title='Get-ChocolateyPath' value='get-chocolateypath' />
7070
* <Xref title='Get-ChocolateyUnzip' value='get-chocolateyunzip' />

0 commit comments

Comments
 (0)