Table of Contents

Interface IOpenPgp

Namespace
ZeroInstall.Store.Trust
Assembly
ZeroInstall.Store.dll

Provides access to an encryption/signature system compatible with the OpenPGP standard.

public interface IOpenPgp
Extension Methods

Methods

ExportKey(IKeyIDContainer)

Exports the public key for a specific key in the keyring.

string ExportKey(IKeyIDContainer keyIDContainer)

Parameters

keyIDContainer IKeyIDContainer

An object containing the key ID of the public key to export.

Returns

string

The public key in ASCII Armored format. Always uses Unix-style linebreaks.

Exceptions

KeyNotFoundException

The specified keyIDContainer could not be found in the keyring.

ImportKey(ArraySegment<byte>)

Imports a public key into the keyring.

void ImportKey(ArraySegment<byte> data)

Parameters

data ArraySegment<byte>

The public key in binary or ASCII Armored format.

Exceptions

InvalidDataException

data does not contain a valid public key.

ListSecretKeys()

Returns a list of secret keys in the keyring.

IEnumerable<OpenPgpSecretKey> ListSecretKeys()

Returns

IEnumerable<OpenPgpSecretKey>

Sign(ArraySegment<byte>, OpenPgpSecretKey, string?)

Creates a detached OpenPGP signature using a specific secret key.

byte[] Sign(ArraySegment<byte> data, OpenPgpSecretKey secretKey, string? passphrase = null)

Parameters

data ArraySegment<byte>

The data to sign.

secretKey OpenPgpSecretKey

The secret key to use for signing.

passphrase string

The passphrase to use to unlock the secret key.

Returns

byte[]

The signature in binary format.

Exceptions

KeyNotFoundException

The specified secretKey could not be found in the keyring.

WrongPassphraseException

passphrase was incorrect.

Verify(ArraySegment<byte>, byte[])

Verifies a detached OpenPGP signature.

IEnumerable<OpenPgpSignature> Verify(ArraySegment<byte> data, byte[] signature)

Parameters

data ArraySegment<byte>

The data the signature is for.

signature byte[]

The signature in binary format.

Returns

IEnumerable<OpenPgpSignature>

A list of signatures found, both valid and invalid. MissingKeySignature results indicate you need to use ImportKey(ArraySegment<byte>).

Exceptions

SignatureException

signature does not contain syntactically correct signature data.