# Installation

## Downloading Kryptor

Pre-built binaries for Windows (x64), Linux (x64 and ARM64), and macOS (x64 and ARM64) are available on the [Introduction](/master.md#download-kryptor) page.

Kryptor is also available as a package from [several package managers](/master.md#download-kryptor), although **help is wanted** to make it available elsewhere.

## Building Kryptor from source

### Downloading the source code

1. Go to the [**latest release**](https://github.com/samuel-lucas6/Kryptor/releases/latest) on GitHub and download the `Source code (zip)` asset.
2. Navigate to the download location and extract the ZIP file.

{% hint style="warning" %}
Do **NOT** download the source code from the *master* branch.
{% endhint %}

### Using the .NET CLI

1. Install the latest [.NET 8 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0). This may be newer than the SDK and runtime version used to build the release files.
2. Navigate to the `src` folder in the terminal (e.g. `cd Downloads\Kryptor-4.0.0\src`).
3. Copy and paste the following command for the operating system and architecture you'd like to build for:

#### Windows (x64)

```bash
dotnet publish -c Release -r win-x64
```

{% hint style="info" %}
The [libsodium](https://doc.libsodium.org/) library requires the [Visual C++ Redistributable for Visual Studio 2015-2022](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170) to work on Windows. However, the appropriate `vcruntime140.dll` is automatically written to disk by Kryptor.
{% endhint %}

#### Linux (x64)

```bash
dotnet publish -c Release -r linux-x64
```

#### macOS (x64)

```bash
dotnet publish -c Release -r osx-x64
```

{% hint style="warning" %}
**For macOS (x64/ARM64)**, there is currently an [upstream issue](https://github.com/dotnet/sdk/issues/45903) in the .NET SDK that prevents the libsodium library from being bundled correctly into the Kryptor executable. The .NET team has not investigated this for over a year, so this is unlikely to be fixed.

Until this is resolved, you must keep the `libsodium.dylib` file (from the `publish` folder) in the same directory as the `kryptor` file.
{% endhint %}

#### Linux (ARM64)

```bash
dotnet publish -c Release -r linux-arm64
```

#### macOS (ARM64)

```bash
dotnet publish -c Release -r osx-arm64
```

{% hint style="warning" %}
Publishing for `osx-arm64` [requires](https://github.com/dotnet/runtime/discussions/66574) using macOS because Apple Silicon Macs require code signing.
{% endhint %}

{% hint style="warning" %}
**For macOS (x64/ARM64)**, there is currently an [upstream issue](https://github.com/dotnet/sdk/issues/45903) in the .NET SDK that prevents the libsodium library from being bundled correctly into the Kryptor executable. The .NET team has not investigated this for over a year, so this is unlikely to be fixed.

Until this is resolved, you must keep the `libsodium.dylib` file (from the `publish` folder) in the same directory as the `kryptor` file.
{% endhint %}

#### Linux (ARM)

```bash
dotnet publish -c Release -r linux-arm
```

{% hint style="warning" %}
`win-arm64` isn't supported yet. Currently, `linux-arm`, `linux-arm64`, `linux-musl-arm64`, and `linux-musl-x64` are not tested. Better support and testing are on the [roadmap](/roadmap.md).
{% endhint %}

{% hint style="info" %}
A full list of .NET CLI publish options can be found [here](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish). The settings Kryptor uses can be found in the [Kryptor.csproj](https://github.com/samuel-lucas6/Kryptor/blob/master/src/Kryptor/Kryptor.csproj) file.
{% endhint %}

## Verifying signatures

If you already have Kryptor installed, you can use the previous version to verify the `.signature` file for your new download.

{% hint style="info" %}
If you don't have a previous version of Kryptor installed, you should follow the [Verifying digests](#verifying-digests) section below instead.
{% endhint %}

1. Download the signature file for your version of Kryptor [here](/master.md#download-kryptor).
2. Make sure the `.signature` file is in the same directory as the downloaded Kryptor `.zip` file.
3. Open the `Command Prompt` on Windows (e.g. search for `cmd` in the taskbar) or the `terminal` on Linux and macOS (e.g. search your programs for `terminal`).
4. For v4 and above, copy and paste the following command, replacing `[file]` with the file path of the Kryptor `.zip` file:

```bash
kryptor -v -y Ed//bnY+xqUXVMaaI0poBwTqDRlKA9+x9FjlDAHE9MmXKG4= "[file]"
```

For v3, use the following command instead:

```bash
kryptor -v -y RWRudj7GpRdUxpojSmgHBOoNGUoD37H0WOUMAcT0yZcobg== "[file]"
```

Kryptor should display the message '`Good signature`', followed by the authenticated comment '`Kryptor v[version]`'.

{% hint style="danger" %}
If you see '`Bad signature`', your download is either corrupted or not legitimate and may be unsafe.​
{% endhint %}

## Verifying digests

### Windows

1. Download the latest SHA-256 `.digest` file [here](/master.md#download-kryptor).
2. Open a `PowerShell` window (e.g. search `PowerShell` in the taskbar).
3. Navigate to the directory of the downloaded Kryptor `.zip` file (e.g. `cd Downloads`).
4. Copy and paste the following command into PowerShell:

```powershell
(Get-FileHash .\kryptor-windows-x64.zip).Hash -eq (Get-Content .\kryptor-windows-x64.zip.digest).split(" ")[0].ToUpper()
```

The word `True` should appear in the `PowerShell` window.

{% hint style="danger" %}
If you see `False`, your download is either corrupted or not legitimate and may be unsafe.​
{% endhint %}

### Linux and macOS

1. Download the latest SHA-256 `.digest` file [here](/master.md#download-kryptor).
2. Open a `terminal` window (e.g. search your programs for `terminal`).
3. Navigate to the directory of the downloaded Kryptor `.zip` file (e.g. `cd Downloads`).
4. Copy and paste the following command, replacing `[file]` with the file name of the `.zip` file:

```bash
shasum -a 256 -c [file].digest
```

The word `OK` should appear.

{% hint style="danger" %}
If you see another message, your download is either corrupted or not legitimate and may be unsafe.​
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.kryptor.co.uk/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
