Skip to content

Commit

Permalink
Update docs. Auto generate umbrella. Build frameworks. Bump version t…
Browse files Browse the repository at this point in the history
…o 0.9
  • Loading branch information
krzyzanowskim committed Oct 9, 2017
1 parent 437bebb commit 3b14f8f
Show file tree
Hide file tree
Showing 146 changed files with 3,066 additions and 533 deletions.
2 changes: 1 addition & 1 deletion .swift-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1
4.0
5 changes: 3 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Version 0.9
- Fixes keys management (import/export issues).
- Fixes instances equality.
- Fixes partial packets with zero body length.
- Reverts NSSet collections to NSArray.
- Improves objects copying (NSCopying for packets).
- Reverts NSSet collections to NSArray.
- Updates public API (cleanups).
- Updates tests.
- Updates documentations.
- Updates API.

Version 0.8
- Adds public and private keys generation feature with PGPKeyGenerator
Expand Down
5 changes: 4 additions & 1 deletion Config/Defaults.xcconfig
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ VALID_ARCHS[sdk=macosx*] = x86_64 i386
MACOSX_DEPLOYMENT_TARGET = 10.9
IPHONEOS_DEPLOYMENT_TARGET = 8.0

FRAMEWORK_SEARCH_PATHS = $(inherited) $(PROJECT_DIR)

HEADER_SEARCH_PATHS[sdk=iphoneos*] = $(SRCROOT)/vendor/libs/ios
HEADER_SEARCH_PATHS[sdk=iphonesimulator*] = $(SRCROOT)/vendor/libs/ios
HEADER_SEARCH_PATHS[sdk=macosx*] = $(SRCROOT)/vendor/libs/macosx
Expand Down Expand Up @@ -86,6 +88,7 @@ STRIP_STYLE = debugging
// Module
DEFINES_MODULE = YES
CLANG_ENABLE_MODULES = YES
MODULE_NAME = $(PRODUCT_NAME:c99extidentifier)

GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES
GCC_PRECOMPILE_PREFIX_HEADER = NO
Expand Down Expand Up @@ -122,7 +125,7 @@ GCC_NO_COMMON_BLOCKS = YES
COMBINE_HIDPI_IMAGES = YES

// :MARK: -Swift
SWIFT_VERSION = 3.0
SWIFT_VERSION = 4.0
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG

// Xcode 8.3+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleShortVersionString</key>
<string>0.8.0</string>
<string>0.9.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
Expand Down
Binary file not shown.
45 changes: 11 additions & 34 deletions Frameworks/ios/ObjectivePGP.framework/Headers/ObjectivePGP.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//
// ObjectivePGP.h
// ObjectivePGP
//
// Created by Marcin Krzyzanowski on 05/07/2017.
// Copyright © 2017 Marcin Krzyżanowski. All rights reserved.
// Copyright © Marcin Krzyżanowski. All rights reserved.
//
// DO NOT MODIFY. FILE GENERATED AUTOMATICALLY.

#import <Foundation/Foundation.h>

Expand All @@ -14,38 +13,16 @@ FOUNDATION_EXPORT double ObjectivePGPVersionNumber;
//! Project version string for ObjectivePGP.
FOUNDATION_EXPORT const unsigned char ObjectivePGPVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <ObjectivePGP/PublicHeader.h>

#import <ObjectivePGP/PGPMacros.h>
#import <ObjectivePGP/PGPFoundation.h>
#import <ObjectivePGP/PGPTypes.h>
#import <ObjectivePGP/ObjectivePGPObject.h>
#import <ObjectivePGP/PGPKey.h>
#import <ObjectivePGP/PGPKeyGenerator.h>
#import <ObjectivePGP/PGPKeyMaterial.h>
#import <ObjectivePGP/PGPTypes.h>
#import <ObjectivePGP/PGPArmor.h>
#import <ObjectivePGP/PGPCompressedPacket.h>
#import <ObjectivePGP/PGPCryptoCFB.h>
#import <ObjectivePGP/PGPLiteralPacket.h>
#import <ObjectivePGP/PGPLogging.h>
#import <ObjectivePGP/PGPModificationDetectionCodePacket.h>
#import <ObjectivePGP/PGPOnePassSignaturePacket.h>
#import <ObjectivePGP/PGPSignaturePacket.h>
#import <ObjectivePGP/PGPSignatureSubpacket.h>
#import <ObjectivePGP/PGPSignatureSubpacketHeader.h>
#import <ObjectivePGP/PGPSignatureSubpacketCreationTime.h>
#import <ObjectivePGP/PGPPKCSEme.h>
#import <ObjectivePGP/PGPPKCSEmsa.h>
#import <ObjectivePGP/PGPPublicKeyEncryptedSessionKeyPacket.h>
#import <ObjectivePGP/PGPPublicKeyPacket.h>
#import <ObjectivePGP/PGPPublicSubKeyPacket.h>
#import <ObjectivePGP/PGPSecretKeyPacket.h>
#import <ObjectivePGP/PGPSecretSubKeyPacket.h>
#import <ObjectivePGP/PGPPartialSubKey.h>
#import <ObjectivePGP/PGPSymmetricallyEncryptedDataPacket.h>
#import <ObjectivePGP/PGPSymmetricallyEncryptedDataPacket.h>
#import <ObjectivePGP/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h>
#import <ObjectivePGP/PGPTrustPacket.h>
#import <ObjectivePGP/PGPFingerprint.h>
#import <ObjectivePGP/PGPKeyID.h>
#import <ObjectivePGP/PGPUser.h>
#import <ObjectivePGP/PGPUserAttributePacket.h>
#import <ObjectivePGP/PGPUserIDPacket.h>
#import <ObjectivePGP/PGPPacketProtocol.h>
#import <ObjectivePGP/PGPPartialSubKey.h>
#import <ObjectivePGP/PGPPartialKey.h>
#import <ObjectivePGP/PGPKey.h>
#import <ObjectivePGP/PGPExportableProtocol.h>
#import <ObjectivePGP/PGPArmor.h>
155 changes: 95 additions & 60 deletions Frameworks/ios/ObjectivePGP.framework/Headers/ObjectivePGPObject.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// ObjectivePGP.h
// ObjectivePGP
// Copyright (c) Marcin Krzyżanowski. All rights reserved.
//
// Created by Marcin Krzyzanowski on 03/05/14.
// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved.
// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY
// INTERNATIONAL COPYRIGHT LAW. USAGE IS BOUND TO THE LICENSE AGREEMENT.
// This notice may not be removed from this file.
//

#import "PGPKey.h"
Expand All @@ -15,118 +15,101 @@ NS_ASSUME_NONNULL_BEGIN
@interface ObjectivePGP : NSObject

/// Imported keys.
@property (strong, nonatomic, readonly) NSSet<PGPKey *> *keys;

/*
Import keys. `keys` property is updated after successfull import.
@param path keys to load.
@return Set of loaded keys.
*/
- (NSSet<PGPKey *> *)importKeys:(NSSet<PGPKey *> *)keys;
@property (strong, nonatomic, readonly) NSArray<PGPKey *> *keys;

/**
Import keys from the file. `keys` property is updated after successfull import.
Import keys. `keys` property is updated after successfull import.
@param path Path to the file with the keys.
@return Set of loaded keys.
@param keys Keys to import.
*/
- (NSSet<PGPKey *> *)importKeysFromFile:(NSString *)path;
- (void)importKeys:(NSArray<PGPKey *> *)keys NS_SWIFT_NAME(import(keys:));

/**
Import keys from the data. `keys` property is updated after successfull import.
Import key with given identifier
@param data Keys data.
@return Set of loaded keys.
@param keyIdentifier Short (8 characters) key identifier to load.
@param path Path to the file with the keys.
@return YES on success.
*/
- (NSSet<PGPKey *> *)importKeysFromData:(NSData *)data;
- (BOOL)importKey:(NSString *)identifier fromFile:(NSString *)path NS_SWIFT_NAME(import(keyIdentifier:fromFile:));

/**
Delete keys
@param keys Keys to delete from keys object
*/
- (void)deleteKeys:(NSArray<PGPKey *> *)keys;

/**
Import key with given identifier
@param shortKeyStringIdentifier Short (8 characters) key identifier to load.
@param path Path to the file with the keys.
@return YES on success.
@param keys Keys to delete from the `keys` collection.
*/
- (BOOL)importKey:(NSString *)shortKeyStringIdentifier fromFile:(NSString *)path;
- (void)deleteKeys:(NSArray<PGPKey *> *)keys NS_SWIFT_NAME(delete(keys:));

/**
Read keys from the data. Does not import the keys.
@param fileData Keys data.
@return Array of parsed keys.
@param data Key or keyring data.
@return Array of read keys.
*/
- (NSSet<PGPKey *> *)keysFromData:(NSData *)fileData;
+ (NSArray<PGPKey *> *)readKeysFromData:(NSData *)data NS_SWIFT_NAME(readKeys(from:));

/**
Read keys from the file. Does not import the keys.
@param path Path to the keys file.
@return Array of parsed keys.
@return Array of read keys.
*/
- (NSSet<PGPKey *> *)keysFromFile:(NSString *)path;
+ (NSArray<PGPKey *> *)readKeysFromFile:(NSString *)path NS_SWIFT_NAME(readKeys(from:));

/**
Save keys of given type (public or private) to the file.
Export, previously imported, keys of given type (public or secret) to the file at given path.
@param type Keys type.
@param path Full path to the destination file.
@param error Error.
@return YES on success.
*/
- (BOOL)exportKeysOfType:(PGPPartialKeyType)type toFile:(NSString *)path error:(NSError *__autoreleasing _Nullable *)error;
- (BOOL)exportKeysOfType:(PGPPartialKeyType)type toFile:(NSString *)path error:(NSError *__autoreleasing _Nullable *)error NS_SWIFT_NAME(export(type:to:));

/**
Export key data.
Export, previously imported, single key data.
@param key Key to export.
@param armored Choose the format. Binary or Armored (armored is a string based format)
@return Data or `nil` if can't export key.
@return Data, or `nil` if can't export the key.
*/
- (nullable NSData *)exportKey:(PGPKey *)key armored:(BOOL)armored;
- (nullable NSData *)exportKey:(PGPKey *)key armored:(BOOL)armored NS_SWIFT_NAME(export(key:armored:));

/**
Search for string based key identifier.
Search imported keys for the key identifier.
@param keyIdentifier Key identifier. Short (8 characters, e.g: 4EF122E5) or long (16 characters, e.g: 71180E514EF122E5) identifier.
@return Key instance, or `nil` if not found.
@param identifier Key identifier. Short (8 characters, e.g: "4EF122E5") or long (16 characters, e.g: "71180E514EF122E5") identifier.
@return Key instance, or `nil` if the key is not found.
*/
- (nullable PGPKey *)findKeyForIdentifier:(NSString *)keyIdentifier;
- (nullable PGPKey *)findKeyWithIdentifier:(NSString *)identifier NS_SWIFT_NAME(findKey(_:));

/**
Search for key id.
Search imported keys for key id instance.
@param keyID Key identifier.
@return Key instance or `nil` if not found.
*/
- (nullable PGPKey *)findKeyForKeyID:(PGPKeyID *)keyID;
- (nullable PGPKey *)findKeyWithKeyID:(PGPKeyID *)keyID NS_SWIFT_NAME(findKey(_:));

/**
Search for keys for given user id.
Search imported keys for given user id.
@param userID A string based identifier (usually name with the e-mail address).
@return Array of found keys, or empty array if not found.
*/
- (NSSet<PGPKey *> *)findKeysForUserID:(NSString *)userID;
- (NSArray<PGPKey *> *)findKeysForUserID:(NSString *)userID NS_SWIFT_NAME(findKeys(_:));

/**
Sign data using a key.
@param dataToSign Data to sign.
@param data Data to sign.
@param key Key to be used to sign.
@param passphrase Optional. Passphrase for the key.
@param detached whether output detached signature.
@param detached Whether result in detachec signature only, or return input data with a signature.
@param error Error.
@return Signed data, or `nil` if fail.
*/
- (nullable NSData *)signData:(NSData *)dataToSign usingKey:(PGPKey *)key passphrase:(nullable NSString *)passphrase detached:(BOOL)detached error:(NSError *__autoreleasing _Nullable *)error;
- (nullable NSData *)sign:(NSData *)data usingKey:(PGPKey *)key passphrase:(nullable NSString *)passphrase detached:(BOOL)detached error:(NSError *__autoreleasing _Nullable *)error;

/**
Verify signed data. Validates with the imported keys.
Expand All @@ -135,7 +118,7 @@ NS_ASSUME_NONNULL_BEGIN
@param error Error
@return YES on success.
*/
- (BOOL)verifyData:(NSData *)signedData error:(NSError *__autoreleasing _Nullable *)error;
- (BOOL)verify:(NSData *)data error:(NSError *__autoreleasing _Nullable *)error;

/**
Verify signed data, with detached signature data.
Expand All @@ -145,7 +128,7 @@ NS_ASSUME_NONNULL_BEGIN
@param error Error
@return YES on success.
*/
- (BOOL)verifyData:(NSData *)signedData withSignature:(NSData *)signatureData error:(NSError *__autoreleasing _Nullable *)error;
- (BOOL)verify:(NSData *)data withSignature:(NSData *)signature error:(NSError *__autoreleasing _Nullable *)error;

/**
Verify signed data using given key.
Expand All @@ -156,13 +139,65 @@ NS_ASSUME_NONNULL_BEGIN
@param error Error.
@return YES on success.
*/
- (BOOL)verifyData:(NSData *)signedData withSignature:(NSData *)signatureData usingKey:(PGPKey *)key error:(NSError *__autoreleasing _Nullable *)error;
- (BOOL)verify:(NSData *)data withSignature:(NSData *)signature usingKey:(PGPKey *)key error:(NSError *__autoreleasing _Nullable *)error;

/**
Encrypt data using given keys. Output in binary or ASCII format.
@param data Data to encrypt.
@param keys Keys to use to encrypte `data`
@param armored Whether the output data should be armored (ASCII format) or not.
@param error Error.
@return Encrypted data in requested format.
*/
- (nullable NSData *)encrypt:(NSData *)data usingKeys:(NSArray<PGPKey *> *)keys armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error;


/**
Encrypt and sign input data with given keys. Output in binary or ASCII format.
@param data Data to encrypt and sign.
@param keys Keys to use to encrypte `data`.
@param signKey Key to use to sign `data`.
@param passphrase Optional. Passphrase for signature key.
@param armored Whether the output data should be armored (ASCII format) or not.
@param error Error.
@return Encrypted and signed data in requested format.
*/
- (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;


/**
Decrypt encrypted message data.
@param data Data to decrypt.
@param passphrase Optional. Passphrase for the key to decrypt.
@param error Error.
@return Decrypted data.
*/
- (nullable NSData *)decrypt:(NSData *)data passphrase:(nullable NSString *)passphrase error:(NSError *__autoreleasing _Nullable *)error;


/**
Decrypt encrypted message data, and verify the signature.
@param data Data to decrypt.
@param passphrase Optional. Passphrase for the key to decrypt.
@param key Key to use to decrypt message.
@param isSigned Whether message is signed.
@param isValid whether message is valid.
@param isIntegrityProtected Whether message integrity is protected;
@param error Error.
@return Decrypted data.
*/
- (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;


- (nullable NSData *)encryptData:(NSData *)dataToEncrypt usingKeys:(NSArray<PGPKey *> *)keys armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error;
- (nullable NSData *)encryptData:(NSData *)dataToEncrypt usingKeys:(NSArray<PGPKey *> *)keys signWithKey:(nullable PGPKey *)signKey passphrase:(nullable NSString *)passphrase armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error;
/// Deprecated.
- (NSSet<PGPKey *> *)importreadKeysFromData:(NSData *)data DEPRECATED_MSG_ATTRIBUTE("Use +[ObjectivePGP readKeysFromData:] instead");

- (nullable NSData *)decryptData:(NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase error:(NSError *__autoreleasing _Nullable *)error;
- (nullable NSData *)decryptData:(NSData *)messageDataToDecrypt 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;
/// Deprecated.
- (NSSet<PGPKey *> *)importKeysFromFile:(NSString *)path DEPRECATED_MSG_ATTRIBUTE("Use +[ObjectivePGP readKeysFromFile:] instead.");

@end

Expand Down
10 changes: 5 additions & 5 deletions Frameworks/ios/ObjectivePGP.framework/Headers/PGPArmor.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//
// PGPArmor.h
// ObjectivePGP
// Copyright (c) Marcin Krzyżanowski. All rights reserved.
//
// Created by Marcin Krzyzanowski on 18/05/14.
// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved.
// THIS SOURCE CODE AND ANY ACCOMPANYING DOCUMENTATION ARE PROTECTED BY
// INTERNATIONAL COPYRIGHT LAW. USAGE IS BOUND TO THE LICENSE AGREEMENT.
// This notice may not be removed from this file.
//

#import <Foundation/Foundation.h>
Expand All @@ -21,7 +21,7 @@ typedef NS_ENUM(NSUInteger, PGPArmorType) {
NS_ASSUME_NONNULL_BEGIN

/// ASCII Armor message.
@interface PGPArmor : NSObject
NS_SWIFT_NAME(Armor) @interface PGPArmor : NSObject

+ (NSData *)armoredData:(NSData *)dataToArmor as:(PGPArmorType)armorType part:(NSUInteger)part of:(NSUInteger)ofParts;
+ (NSData *)armoredData:(NSData *)dataToArmor as:(PGPArmorType)armorType;
Expand Down
Loading

0 comments on commit 3b14f8f

Please sign in to comment.