# GPGEngine

> Inherits From:
>   GPGObject : NSObject

> Declared In:
>   GPGME/GPGEngine.h

## Class Description

GPGME supports several cryptographic protocols, however, it does not implement them. Rather it uses backends (also called engines) which implement the protocol. GPGME uses inter-process communication to pass data back and forth between the application and the backend, but the details of the communication protocol and invocation of the backend is completely hidden by the interface. All complexity is handled by GPGME. Where an exchange of information between the application and the backend is necessary, GPGME provides the necessary callback method hooks and further interfaces.

## Defined Types

> #### Synopsis:

> `typedef enum {
> GPGOpenPGPProtocol = 0,
> GPGCMSProtocol = 1
> } GPGProtocol;`

> #### Description:

> The GPGProtocol type specifies the set of possible protocol values that are supported by GPGME. The following protocols are supported:

> GPGOpenPGPProtocol | Default protocol. OpenPGP is implemented by GnuPG, the GNU Privacy Guard. This is the first protocol that was supported by GPGME.
> GPGCMSProtocol | CMS (Cryptographic Message Syntax) is implemented by GpgSM, the S/MIME implementation for GnuPG. CAUTION: currently unsupported on MacOS X.

## Symbolic Constants

> #### Synopsis:

> `GPGENGINE_H`

## Method Types

>   + checkVersionForProtocol:
>   + checkFrameworkVersion:
>   + availableEngines
>   - engineProtocol
>   - executablePath
>   - version
>   - requestedVersion

## Class Methods

### availableEngines

`+ (NSArray *)availableEngines`

Returns an array of GPGEngine instances. Each instance describes one configured backend.

### checkFrameworkVersion:

`+ (NSString *)checkFrameworkVersion:(NSString *)requiredVersion`

Checks that the version of the framework is at minimum the requested one and returns the version string; returns nil if the condition is not met or requiredVersion is not a valid version number. If requiredVersion is nil, no check is done and the version string is simply returned.

Note that this check is automatically performed before any GPGME object/function is used; it is called from +[GPGObject initialize].

### checkVersionForProtocol:

`+ (GPGError)checkVersionForProtocol:(GPGProtocol)protocol`

Checks that the engine implementing the protocol protocol is installed in the expected path and meets the version requirement of GPGME.

This method returns GPGErrorNoError if the engine is available and an error whose code is GPGErrorInvalidEngine if it is not.

## Instance Methods

### engineProtocol

`- (GPGProtocol)engineProtocol`

Returns the protocol for which the crypto engine is used. You can convert this to a string with GPGProtocolDescription() or GPGLocalizedProtocolDescription() for printing

### executablePath

`- (NSString *)executablePath`

Returns a string holding the file name of the executable of the crypto engine. Currently, it is never nil, but using nil is reserved for future use, so always check before you use it.

### requestedVersion

`- (NSString *)requestedVersion`

Returns a string containing the minimum required version number of the crypto engine for GPGME to work correctly. This is the version number that +checkVersionForProtocol: verifies against. Currently, it is never nil, but using nil is reserved for future use, so always check before you use it.

### version

`- (NSString *)version`

This is a string containing the version number of the crypto engine. It might be nil if the version number can not be determined, for example because the executable doesn't exist or is invalid.

Version 1.1 Copyright ©2005 by Mac GPG Project. All Rights Reserved. Sun Jan 23 16:54:41 2005