# GPGSignature

> Inherits From:
>   NSObject

> Conforms To:
>   NSCopying

> Declared In:
>   GPGME/GPGSignature.h

## Class Description

GPGSignature instances are returned by -[GPGContext signatures]; you should never need to instantiate yourself objects of that class. Signatures are also returned after a signing operation, but in this case, currently, not all attributes have significant values: you can count only on -algorithm, -hashAlgorithm, -signatureClass, -creationDate and -fingerprint

## Defined Types

> #### Synopsis:

> `typedef enum {
> GPGSignatureSummaryValidMask = 0x0001,
> GPGSignatureSummaryGreenMask = 0x0002,
> GPGSignatureSummaryRedMask = 0x0004,
> GPGSignatureSummaryKeyRevokedMask = 0x0010,
> GPGSignatureSummaryKeyExpiredMask = 0x0020,
> GPGSignatureSummarySignatureExpiredMask = 0x0040,
> GPGSignatureSummaryKeyMissingMask = 0x0080,
> GPGSignatureSummaryCRLMissingMask = 0x0100,
> GPGSignatureSummaryCRLTooOldMask = 0x0200,
> GPGSignatureSummaryBadPolicyMask = 0x0400,
> GPGSignatureSummarySystemErrorMask = 0x0800
> }GPGSignatureSummaryMask;`

> #### Description:

> Mask values used in -summary.

> GPGSignatureSummaryValidMask | The signature is fully valid.
> GPGSignatureSummaryGreenMask | The signature is good but one might want to display some extra information. Check the other bits.
> GPGSignatureSummaryRedMask | The signature is bad. It might be useful to check other bits and display more information, i.e. a revoked certificate might not render a signature invalid when the message was received prior to the cause for the revocation.
> GPGSignatureSummaryKeyRevokedMask | The key or at least one certificate has been revoked.
> GPGSignatureSummaryKeyExpiredMask | The key or one of the certificates has expired. It is probably a good idea to display the date of the expiration.
> GPGSignatureSummarySignatureExpiredMask | The signature has expired
> GPGSignatureSummaryKeyMissingMask | Can't verify due to a missing key or certificate.
> GPGSignatureSummaryCRLMissingMask | The CRL (or an equivalent mechanism) is not available.
> GPGSignatureSummaryCRLTooOldMask | Available CRL is too old.
> GPGSignatureSummaryBadPolicyMask | A policy requirement was not met.
> GPGSignatureSummarySystemErrorMask | A system error occured.

## Symbolic Constants

> #### Synopsis:

> `GPGSIGNATURE_H`

## Instance Variables

> `NSString *_fingerprint;`
> `NSCalendarDate *_creationDate;`
> `NSCalendarDate *_expirationDate;`
> `GPGValidity _validity;`
> `GPGError _status;`
> `GPGSignatureSummaryMask _summary;`
> `NSDictionary *_notations;`
> `NSArray *_policyURLs;`
> `GPGError _validityError;`
> `BOOL _wrongKeyUsage;`
> `GPGPublicKeyAlgorithm _algorithm;`
> `GPGHashAlgorithm _hashAlgorithm;`
> `unsigned int _signatureClass;`

> _fingerprint | No description.
> _creationDate | No description.
> _expirationDate | No description.
> _validity | No description.
> _status | No description.
> _summary | No description.
> _notations | No description.
> _policyURLs | No description.
> _validityError | No description.
> _wrongKeyUsage | No description.
> _algorithm | No description.
> _hashAlgorithm | No description.
> _signatureClass | No description.

## Method Types

> Attributes
>   - fingerprint
>   - creationDate
>   - expirationDate
>   - validity
>   - status
>   - summary
>   - algorithm
>   - hashAlgorithm
>   - signatureClass
> Notations
>   - notations
>   - policyURLs
> Misc
>   - validityError
>   - wrongKeyUsage
> Convenience methods
>   - validityDescription
>   - algorithmDescription
>   - hashAlgorithmDescription
>   - formattedFingerprint

## Instance Methods

### algorithm

`- (GPGPublicKeyAlgorithm)algorithm`

Returns the algorithm used to create the signature. Not (yet?) available for signatures returned after a verification operation.

### algorithmDescription

`- (NSString *)algorithmDescription`

Returns the localized description of the algorithm used to create the signature. Not (yet?) available for signatures returned after a verification operation.

### creationDate

`- (NSCalendarDate *)creationDate`

Returns signature creation date. Returns nil when not available or invalid.

### expirationDate

`- (NSCalendarDate *)expirationDate`

Returns signature expiration date. Returns nil if signature does not expire. Not used for new signatures.

### fingerprint

`- (NSString *)fingerprint`

Returns signer's key fingerprint (or keyID!).

### formattedFingerprint

`- (NSString *)formattedFingerprint`

If -fingerprint returns a fingerprint, returns fingerprint in hex digit form, formatted like this:

XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX

or

XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX XX

If -fingerprint returns a keyID, return keyID prefixed by 0x.

### hashAlgorithm

`- (GPGHashAlgorithm)hashAlgorithm`

Returns the hash algorithm used for the newly-created signature.

### hashAlgorithmDescription

`- (NSString *)hashAlgorithmDescription`

Returns the localized description of the algorithm used for the newly-created signature.

### notations

`- (NSDictionary *)notations`

Returns a dictionary of notation data key-value pairs. A notation is a key/value pair that is added to the content, it can be anything. Value is returned as an NSString instance. Not used for new signatures.

### policyURLs

`- (NSArray *)policyURLs`

Returns an array of policy URLs as NSString instances. A policy URL is an URL to a document that documents the persons policy in signing other peoples keys. Not used for new signatures.

### signatureClass

`- (unsigned int)signatureClass`

Returns the signature class of a key signature or a new signature. The meaning is specific to the crypto engine.

This attribute is not (yet?) available for signatures returned after a verification operation.

### status

`- (GPGError)status`

Returns signature status. In particular, the following status codes are of interest:

GPGErrorNoError | This status indicates that the signature is valid. For the combined result this status means that all signatures are valid.
GPGErrorSignatureExpired | This status indicates that the signature is valid but expired. For the combined result this status means that all signatures are valid and expired.
GPGErrorKeyExpired | This status indicates that the signature is valid but the key used to verify the signature has expired. For the combined result this status means that all signatures are valid and all keys are expired.
GPGErrorCertificateRevoked | This status indicates that the signature is valid but the key used to verify the signature has been revoked. For the combined result this status means that all signatures are valid and all keys are revoked.
GPGErrorBadSignature | This status indicates that the signature is invalid. For the combined result this status means that all signatures are invalid.
GPGErrorNoPublicKey | This status indicates that the signature could not be verified due to a missing key. For the combined result this status means that all signatures could not be checked due to missing keys.
GPGErrorGeneralError | This status indicates that there was some other error which prevented the signature verification.

Not used for new signatures.

### summary

`- (GPGSignatureSummaryMask)summary`

Returns a mask giving a summary of the signature status. Not used for new signatures.

### validity

`- (GPGValidity)validity`

Returns signature's validity. Not used for new signatures.

Note that a signature's validity is never GPGValidityUltimate, because GPGValidityUltimate is reserved for key certification, not for signatures.

### validityDescription

`- (NSString *)validityDescription`

Returns signature's validity in localized human readable form. Not used for new signatures.

### validityError

`- (GPGError)validityError`

If a signature is not valid, this provides a reason why. Not used for new signatures.

### wrongKeyUsage

`- (BOOL)wrongKeyUsage`

Returns YES if the key was not used according to its policy. Not used for new signatures.

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