# Generate a PGP key pair

Generate a PGP key pair on Evotec with practical examples, usage guidance, and reusable project workflows.

Project

PSPGP

PSPGP is a PowerShell module that provides PGP functionality in PowerShell. It allows encrypting and decrypting files/folders and strings using PGP.

[View on GitHub](https://github.com/EvotecIT/PSPGP) [Visit Website](#) [Releases](https://github.com/EvotecIT/PSPGP/releases/tag/v1.0.1) [Changelog](#) [Get package](https://www.powershellgallery.com/packages/PSPGP)

Stars**75**

Forks**23**

Open issues**1**

PowerShell Gallery downloads**3831376**

Release**v1.0.2**

Language: C# Updated: 2026-11-23

Curated Examples

Use PSPGP to create public and private PGP key files.

This pattern is useful when a workflow needs dedicated PGP keys for encrypted file exchange.

It is adapted from the source example at `Examples/Example-GeneratePGP.ps1`.

## When to use this pattern

- You need a project-specific PGP key pair.
- The public key will be shared with another party.
- The private key and password will be stored securely outside the script.

## Example

```powershell
Import-Module PSPGP

$keyFolder = Join-Path $PSScriptRoot 'Keys'
New-Item -ItemType Directory -Force -Path $keyFolder | Out-Null

New-PGPKey `
    -HashAlgorithm Sha512 `
    -FilePathPublic "$keyFolder\PublicPGP.asc" `
    -FilePathPrivate "$keyFolder\PrivatePGP.asc" `
    -UserName 'automation@example.com' `
    -Password '<store-this-securely>'
```

## What this demonstrates

- creating a public/private key pair
- choosing a hash algorithm
- keeping file paths explicit for later automation steps

## Source

- [Example-GeneratePGP.ps1](https://github.com/EvotecIT/PSPGP/blob/v2-speedygonzales/Examples/Example-GeneratePGP.ps1)

<!-- PowerForge markdown artifact sha256:D482DFFEAD611D9E5245439C66DD96300F185FBD1F636BBB7A3653F196BDEB6C -->
