# GPGSubkey

> Inherits From:
>   GPGKey : GPGObject : NSObject

> Declared In:
>   GPGME/GPGSubkey.h

## Class Description

Subkeys are one component of a key. In fact, subkeys are those parts that contains the real information about the individual cryptographic keys that belong to the same key object. One GPGKey can contain several subkeys. The first subkey in the -subkeys list is also called the primary key. It is guaranteed that the owning GPGKey instance will never be deallocated before the GPGKeySignature has been deallocated, without creating non-breakable retain-cycles.

GPGSubkey instances do not support all methods from GPGKey; use only the listed ones, else a NSInternalInconsistencyException exception will be raised.

The following convenience methods, though not listed, are supported: -algorithmDescription, -shortKeyID, -formattedFingerprint

## Symbolic Constants

> #### Synopsis:

> `GPGSUBKEY_H`

## Instance Variables

> `GPGKey *_key;`
> `int _refCount;`

> _key | Key owning the subkey; not retained
> _refCount | No description.

## Method Types

>   - key
>   - isKeyRevoked
>   - isKeyInvalid
>   - hasKeyExpired
>   - isKeyDisabled
>   - isSecret
>   - algorithm
>   - length
>   - keyID
>   - fingerprint
>   - creationDate
>   - expirationDate
> Global subkey capabilities
>   - canEncrypt
>   - canSign
>   - canCertify
>   - canAuthenticate

## Instance Methods

### algorithm

`- (GPGPublicKeyAlgorithm)algorithm`

Returns subkey algorithm. The algorithm is the crypto algorithm for which the subkey can be used. The value corresponds to the GPGPublicKeyAlgorithm enum values.

### canAuthenticate

`- (BOOL)canAuthenticate`

Returns whether the subkey can be used for authentication.

### canCertify

`- (BOOL)canCertify`

Returns whether the subkey can be used to create key certificates.

### canEncrypt

`- (BOOL)canEncrypt`

Returns whether the subkey can be used for encryption.

### canSign

`- (BOOL)canSign`

Returns whether the subkey can be used to create data signatures.

### creationDate

`- (NSCalendarDate *)creationDate`

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

### expirationDate

`- (NSCalendarDate *)expirationDate`

Returns subkey expiration date. Returns nil when there is none or is not available or is invalid.

### fingerprint

`- (NSString *)fingerprint`

Returns subkey fingerprint in hexadecimal digits, if available. This is usually only available for the primary key.

### hasKeyExpired

`- (BOOL)hasKeyExpired`

Returns whether subkey is expired.

### isKeyDisabled

`- (BOOL)isKeyDisabled`

Returns whether subkey is disabled.

### isKeyInvalid

`- (BOOL)isKeyInvalid`

Returns whether subkey is invalid.

### isKeyRevoked

`- (BOOL)isKeyRevoked`

Returns whether subkey is revoked.

### isSecret

`- (BOOL)isSecret`

Returns whether the subkey is secret.

### key

`- (GPGKey *)key`

Returns parent key.

### keyID

`- (NSString *)keyID`

Returns subkey key ID in hexadecimal digits.

### length

`- (unsigned int)length`

Returns subkey length, in bits.

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