> ## Documentation Index
> Fetch the complete documentation index at: https://docs.directgvr.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate a file before launching it

> Make your launcher or DLM check a file's code signature before it launches the file.

You can have your launcher or download manager (DLM) check a file's signature against a certificate you trust before launching it. This stops someone from swapping in a different file.

## Get the certificate thumbprint

If you own the certificate, use any tool to get its thumbprint. Otherwise, get it from a signed file.

### Windows file

1. In File Explorer, right-click the file and click **Properties**.
2. On the **Digital Signatures** tab, click **Details**.
3. Click **View Certificate**.
4. On the **Details** tab, find **Thumbprint**.
5. Copy the thumbprint value.

### macOS application

1. Open Terminal and go to an empty folder.
2. Extract the certificates:

   ```bash theme={null}
   codesign -dvvvv --extract-certificates /path/to/application/NameofApp.app
   ```

   This usually creates three files: `codesign0`, `codesign1` and `codesign2`.
3. Open **Keychain Access** and drag `codesign0` into a keychain.
4. Double-click the certificate, expand **Details** and scroll to **Fingerprints**.
5. Copy the SHA-256 hash.

### macOS installer package

1. Double-click the `.pkg` file to open the installer.
2. Click the lock icon in the upper-right corner.
3. Expand **Details** and scroll to **Fingerprints**.
4. Copy the SHA-256 fingerprint.

## Encode the thumbprint in Base64

Convert the hex thumbprint to Base64 with a hex-to-Base64 converter, such as [Base64.guru](https://base64.guru/converter/encode/hex) or [Cryptii](https://cryptii.com/pipes/hex-to-base64). For example: `JIWnr6mOF4y48wyYODRrUUrqR2k=`.

## Add a thumbprint store

In your skin's root folder, add a `thumbprintStores` entry with the encoded thumbprint to `app.json`:

```json app.json theme={null}
"thumbprintStores": {
  "microsoft": {
    "visualstudio": "JIWnr6mOF4y48wyYODRrUUrqR2k="
  }
},
```

## Validate before launching

Route the `launch` task through a `fileAuthenticate` task that checks the file against your store:

```json workflow.json theme={null}
"launch": {
  "type": "fileAuthenticate",
  "path": "{repositoryDirectory}VSCodeSetup-x64-1.50.0.exe",
  "store": "microsoft",
  "valid": "launchInstaller",
  "notValid": "logFailure"
},
"launchInstaller": {
  "type": "launch",
  "path": "{repositoryDirectory}VSCodeSetup-x64-1.50.0.exe",
  "workingDirectory": "{repositoryDirectory}",
  "elevationRights": "user",
  "successCode": 0,
  "waitForExit": true,
  "ignoreError": true
},
```

The file only launches if it validates against the certificate you allowed. `notValid` routes the workflow to show an error instead.

## Test it

Replace the file with one that isn't signed by the same certificate, or, if you load the skin dynamically, remove `thumbprintStores` from `app.json` before you start the launcher. The launch should fail.

## Related

* [Options for securing metadata](https://docs.directgvr.com/release-automation/securing-metadata.md)
* [Host configuration](https://docs.directgvr.com/reference/client-skin-system/host-configuration.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.