Table of Contents

Class PgpMasterKey

Namespace
Nops.Core.Keys
Assembly
Nops.Core.dll

Master key provider for PGP (OpenPGP) keys. Uses BouncyCastle OpenPGP to decrypt session keys.

public class PgpMasterKey : IMasterKeyProvider
Inheritance
PgpMasterKey
Implements
Inherited Members

Constructors

PgpMasterKey(string, byte[]?, string?)

Creates a PGP master key provider.

public PgpMasterKey(string fingerprint, byte[]? privateKeyBytes = null, string? passphrase = null)

Parameters

fingerprint string

The key fingerprint (hex), or empty to match any key.

privateKeyBytes byte[]

The secret key, ASCII-armored or binary.

passphrase string

The key's passphrase, if it has one.

Properties

Fingerprint

The PGP fingerprint (hex string). May be empty to match any key in the ring.

public string Fingerprint { get; }

Property Value

string

KeyType

The key type identifier ("pgp").

public string KeyType { get; }

Property Value

string

Passphrase

Optional passphrase for the PGP private key. SOPS requires explicit passphrase handling - never silently ignore.

public string? Passphrase { get; }

Property Value

string

PrivateKeyBytes

The PGP private key bytes (ASCII-armored or binary) or null if using external decrypt.

public byte[]? PrivateKeyBytes { get; }

Property Value

byte[]

Methods

DecryptShareAsync(string, CancellationToken)

Decrypt the encrypted data key share using PGP. Returns null if this key cannot decrypt (key ID mismatch or parse error).

public Task<byte[]?> DecryptShareAsync(string enc, CancellationToken ct = default)

Parameters

enc string
ct CancellationToken

Returns

Task<byte[]>