Show / Hide Table of Contents

Interface IOpenPgp

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

Namespace: ZeroInstall.Store.Trust
Assembly: ZeroInstall.Store.dll
Syntax
public interface IOpenPgp

Methods

ExportKey(IKeyIDContainer)

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

Declaration
string ExportKey(IKeyIDContainer keyIDContainer)
Parameters
Type Name Description
IKeyIDContainer keyIDContainer

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

Returns
Type Description
String

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

Exceptions
Type Condition
KeyNotFoundException

The specified keyIDContainer could not be found in the keyring.

See Also
ImportKey(ArraySegment<Byte>)

ImportKey(ArraySegment<Byte>)

Imports a public key into the keyring.

Declaration
void ImportKey(ArraySegment<byte> data)
Parameters
Type Name Description
ArraySegment<Byte> data

The public key in binary or ASCII Armored format.

Exceptions
Type Condition
InvalidDataException

data does not contain a valid public key.

See Also
ExportKey(IKeyIDContainer)

ListSecretKeys()

Returns a list of secret keys in the keyring.

Declaration
IEnumerable<OpenPgpSecretKey> ListSecretKeys()
Returns
Type Description
IEnumerable<OpenPgpSecretKey>
See Also
Sign(ArraySegment<Byte>, OpenPgpSecretKey, String)
ExportKey(IKeyIDContainer)

Sign(ArraySegment<Byte>, OpenPgpSecretKey, String)

Creates a detached OpenPGP signature using a specific secret key.

Declaration
byte[] Sign(ArraySegment<byte> data, OpenPgpSecretKey secretKey, string passphrase = null)
Parameters
Type Name Description
ArraySegment<Byte> data

The data to sign.

OpenPgpSecretKey secretKey

The secret key to use for signing.

String passphrase

The passphrase to use to unlock the secret key.

Returns
Type Description
Byte[]

The signature in binary format.

Exceptions
Type Condition
KeyNotFoundException

The specified secretKey could not be found in the keyring.

WrongPassphraseException

passphrase was incorrect.

See Also
Verify(ArraySegment<Byte>, Byte[])

Verify(ArraySegment<Byte>, Byte[])

Verifies a detached OpenPGP signature.

Declaration
IEnumerable<OpenPgpSignature> Verify(ArraySegment<byte> data, byte[] signature)
Parameters
Type Name Description
ArraySegment<Byte> data

The data the signature is for.

Byte[] signature

The signature in binary format.

Returns
Type Description
IEnumerable<OpenPgpSignature>

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

Exceptions
Type Condition
InvalidDataException

signature does not contain valid signature data.

See Also
Sign(ArraySegment<Byte>, OpenPgpSecretKey, String)

Extension Methods

OpenPgpExtensions.GetSecretKey(IOpenPgp, IKeyIDContainer)
OpenPgpExtensions.GetSecretKey(IOpenPgp, String)
OpenPgpUtils.DeployPublicKey(IOpenPgp, IKeyIDContainer, String)
In This Article
Back to top Copyright Bastian Eicher et al