Inherits from NSObject
Declared in ObjectivePGPObject.h

Overview

ObjectivePGP main class.

Tasks

Properties

keys

@property (strong, nonatomic, readonly) NSArray<PGPKey*> *keys
Discussion

Imported keys.

Declared In

ObjectivePGPObject.h

Class Methods

readKeysFromData:NS_SWIFT_NAME:

+ (NSArray<PGPKey*> *)readKeysFromData:(NSData *)data NS_SWIFT_NAME
Discussion

Read keys from the data. Does not import the keys.

Parameters

data

Key or keyring data.

Return Value

Array of read keys.

Declared In

ObjectivePGPObject.h

readKeysFromFile:NS_SWIFT_NAME:

+ (NSArray<PGPKey*> *)readKeysFromFile:(NSString *)path NS_SWIFT_NAME
Discussion

Read keys from the file. Does not import the keys.

Parameters

path

Path to the keys file.

Return Value

Array of read keys.

Declared In

ObjectivePGPObject.h

Instance Methods

decrypt:passphrase:error:

- (nullable NSData *)decrypt:(NSData *)data passphrase:(nullable NSString *)passphrase error:(NSError *__autoreleasing _Nullable *)error
Discussion

Decrypt encrypted message data.

Parameters

data

Data to decrypt.

passphrase

Optional. Passphrase for the key to decrypt.

error

Error.

Return Value

Decrypted data.

Declared In

ObjectivePGPObject.h

decrypt:passphrase:verifyWithKey:signed:valid:integrityProtected:error:

- (nullable NSData *)decrypt:(NSData *)data passphrase:(nullable NSString *)passphrase verifyWithKey:(nullable PGPKey *)key signed:(nullable BOOL *)isSigned valid:(nullable BOOL *)isValid integrityProtected:(nullable BOOL *)isIntegrityProtected error:(NSError *__autoreleasing _Nullable *)error
Discussion

Decrypt encrypted message data, and verify the signature.

Parameters

data

Data to decrypt.

passphrase

Optional. Passphrase for the key to decrypt.

key

Key to use to decrypt message.

isSigned

Whether message is signed.

isValid

whether message is valid.

isIntegrityProtected

Whether message integrity is protected;

error

Error.

Return Value

Decrypted data.

Declared In

ObjectivePGPObject.h

deleteKeys:NS_SWIFT_NAME:

- (void)deleteKeys:(NSArray<PGPKey*> *)keys NS_SWIFT_NAME
Discussion

Delete keys

Parameters

keys

Keys to delete from the keys collection.

Declared In

ObjectivePGPObject.h

encrypt:usingKeys:armored:error:

- (nullable NSData *)encrypt:(NSData *)data usingKeys:(NSArray<PGPKey*> *)keys armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error
Discussion

Encrypt data using given keys. Output in binary or ASCII format.

Parameters

data

Data to encrypt.

keys

Keys to use to encrypte data

armored

Whether the output data should be armored (ASCII format) or not.

error

Error.

Return Value

Encrypted data in requested format.

Declared In

ObjectivePGPObject.h

encrypt:usingKeys:signWithKey:passphrase:armored:error:

- (nullable NSData *)encrypt:(NSData *)data usingKeys:(NSArray<PGPKey*> *)keys signWithKey:(nullable PGPKey *)signKey passphrase:(nullable NSString *)passphrase armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error
Discussion

Encrypt and sign input data with given keys. Output in binary or ASCII format.

Parameters

data

Data to encrypt and sign.

keys

Keys to use to encrypte data.

signKey

Key to use to sign data.

passphrase

Optional. Passphrase for signature key.

armored

Whether the output data should be armored (ASCII format) or not.

error

Error.

Return Value

Encrypted and signed data in requested format.

Declared In

ObjectivePGPObject.h

exportKey:armored:NS_SWIFT_NAME:

- (nullable NSData *)exportKey:(PGPKey *)key armored:(BOOL)armored NS_SWIFT_NAME
Discussion

Export, previously imported, single key data.

Parameters

key

Key to export.

armored

Choose the format. Binary or Armored (armored is a string based format)

Return Value

Data, or nil if can’t export the key.

Declared In

ObjectivePGPObject.h

exportKeysOfType:toFile:error:NS_SWIFT_NAME:

- (BOOL)exportKeysOfType:(PGPPartialKeyType)type toFile:(NSString *)path error:(NSError *__autoreleasing _Nullable *)error NS_SWIFT_NAME
Discussion

Export, previously imported, keys of given type (public or secret) to the file at given path.

Parameters

type

Keys type.

path

Full path to the destination file.

error

Error.

Return Value

YES on success.

Declared In

ObjectivePGPObject.h

findKeyWithIdentifier:NS_SWIFT_NAME:

- (nullable PGPKey *)findKeyWithIdentifier:(NSString *)identifier NS_SWIFT_NAME
Discussion

Search imported keys for the key identifier.

Parameters

identifier

Key identifier. Short (8 characters, e.g: “4EF122E5”) or long (16 characters, e.g: “71180E514EF122E5”) identifier.

Return Value

Key instance, or nil if the key is not found.

Declared In

ObjectivePGPObject.h

findKeyWithKeyID:NS_SWIFT_NAME:

- (nullable PGPKey *)findKeyWithKeyID:(PGPKeyID *)keyID NS_SWIFT_NAME
Discussion

Search imported keys for key id instance.

Parameters

keyID

Key identifier.

Return Value

Key instance or nil if not found.

Declared In

ObjectivePGPObject.h

findKeysForUserID:NS_SWIFT_NAME:

- (NSArray<PGPKey*> *)findKeysForUserID:(NSString *)userID NS_SWIFT_NAME
Discussion

Search imported keys for given user id.

Parameters

userID

A string based identifier (usually name with the e-mail address).

Return Value

Array of found keys, or empty array if not found.

Declared In

ObjectivePGPObject.h

importKey:fromFile:NS_SWIFT_NAME:

- (BOOL)importKey:(NSString *)identifier fromFile:(NSString *)path NS_SWIFT_NAME
Discussion

Import key with given identifier

Parameters

path

Path to the file with the keys.

keyIdentifier

Short (8 characters) key identifier to load.

Return Value

YES on success.

Declared In

ObjectivePGPObject.h

importKeys:NS_SWIFT_NAME:

- (void)importKeys:(NSArray<PGPKey*> *)keys NS_SWIFT_NAME
Discussion

Import keys. keys property is updated after successfull import.

Parameters

keys

Keys to import.

Declared In

ObjectivePGPObject.h

importKeysFromFile:

- (NSSet<PGPKey*> *)importKeysFromFile:(NSString *)path
Discussion

Deprecated.

Declared In

ObjectivePGPObject.h

importreadKeysFromData:

- (NSSet<PGPKey*> *)importreadKeysFromData:(NSData *)data
Discussion

Deprecated.

Declared In

ObjectivePGPObject.h

sign:usingKey:passphrase:detached:error:

- (nullable NSData *)sign:(NSData *)data usingKey:(PGPKey *)key passphrase:(nullable NSString *)passphrase detached:(BOOL)detached error:(NSError *__autoreleasing _Nullable *)error
Discussion

Sign data using a key.

Parameters

data

Data to sign.

key

Key to be used to sign.

passphrase

Optional. Passphrase for the key.

detached

Whether result in detachec signature only, or return input data with a signature.

error

Error.

Return Value

Signed data, or nil if fail.

Declared In

ObjectivePGPObject.h

verify:error:

- (BOOL)verify:(NSData *)data error:(NSError *__autoreleasing _Nullable *)error
Discussion

Verify signed data. Validates with the imported keys.

Parameters

error

Error

signedData

Signed data.

Return Value

YES on success.

Declared In

ObjectivePGPObject.h

verify:withSignature:error:

- (BOOL)verify:(NSData *)data withSignature:(NSData *)signature error:(NSError *__autoreleasing _Nullable *)error
Discussion

Verify signed data, with detached signature data.

Parameters

error

Error

signatureData

Detached signature data.

signedData

Signed data.

Return Value

YES on success.

Declared In

ObjectivePGPObject.h

verify:withSignature:usingKey:error:

- (BOOL)verify:(NSData *)data withSignature:(NSData *)signature usingKey:(PGPKey *)key error:(NSError *__autoreleasing _Nullable *)error
Discussion

Verify signed data using given key.

Parameters

key

Key to use.

error

Error.

signatureData

Detached signature data.

signedData

Signed data.

Return Value

YES on success.

Declared In

ObjectivePGPObject.h