diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/ObjectivePGP.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/ObjectivePGP.h new file mode 100644 index 0000000000000000000000000000000000000000..e375c89e2ae6655d38c6750e42c0241a29e83fa6 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/ObjectivePGP.h @@ -0,0 +1,28 @@ +// +// ObjectivePGP +// +// Copyright © Marcin Krzyżanowski. All rights reserved. +// +// DO NOT MODIFY. FILE GENERATED AUTOMATICALLY. + +#import <Foundation/Foundation.h> + +//! Project version number for ObjectivePGP. +FOUNDATION_EXPORT double ObjectivePGPVersionNumber; + +//! Project version string for ObjectivePGP. +FOUNDATION_EXPORT const unsigned char ObjectivePGPVersionString[]; + +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/ObjectivePGPObject.h> +#import <ObjectivePGP/PGPKeyGenerator.h> +#import <ObjectivePGP/PGPKeyring.h> +#import <ObjectivePGP/PGPFingerprint.h> +#import <ObjectivePGP/PGPKeyID.h> +#import <ObjectivePGP/PGPUser.h> +#import <ObjectivePGP/PGPPartialSubKey.h> +#import <ObjectivePGP/PGPPartialKey.h> +#import <ObjectivePGP/PGPKey.h> +#import <ObjectivePGP/PGPExportableProtocol.h> +#import <ObjectivePGP/PGPArmor.h> diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/ObjectivePGPObject.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/ObjectivePGPObject.h new file mode 100644 index 0000000000000000000000000000000000000000..e596e2a0eec86d2c270893a8864356e1a3093b57 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/ObjectivePGPObject.h @@ -0,0 +1,126 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPKey.h> +#import <ObjectivePGP/PGPKeyring.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +/** + ObjectivePGP - The Leading OpenPGP Framework for iOS and macOS. + This is the configuration object for framework-global settings. + + @note The ObjectivePGP shared object is a global, thread-safe key/value store. + Use `setValue:forKey:` and `valueForKey:` or the subscripted variants to set/get properties. + */ +@interface ObjectivePGP : NSObject + +/** + The shared ObjectivePGP configuration instance. + @note This is the default instance. + */ +@property (class, atomic, readonly) ObjectivePGP *sharedInstance; + +/** + Default, shared keyring instance. Not used internally. + */ +@property (class, atomic, readonly) PGPKeyring *defaultKeyring; + +/** + Read binary or armored (ASCII) PGP keys from the input. + + @param data Key data or keyring data. + @return Array of read keys. + */ ++ (nullable NSArray<PGPKey *> *)readKeysFromData:(NSData *)data error:(NSError * __autoreleasing _Nullable *)error; + +/** + Read binary or armored (ASCII) PGP keys from the input. + + @param path Path to the file with keys. + @return Array of read keys. + */ ++ (nullable NSArray<PGPKey *> *)readKeysFromPath:(NSString *)path error:(NSError * __autoreleasing _Nullable *)error; + +/** + Sign data using a given key. Use passphrase to unlock the key if needed. + If `detached` is true, output with the signature only. Otherwise, return signed data in PGP format. + + @param data Input data. + @param detached Whether result in only signature (not signed data) + @param keys Keys to be used to sign. + @param passphraseBlock Optional. Handler for passphrase protected keys. Return passphrase for a key in question. + @param error Optional. Error. + @return Signed data, or `nil` if fail. + */ ++ (nullable NSData *)sign:(NSData *)data detached:(BOOL)detached usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey *key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error; + +/** + Verify signed data using given keys. + + @param data Signed data. + @param signature Detached signature data (Optional). If not provided, `data` is expected to be signed. + @param keys Public keys. The provided keys should match the signatures. + @param passphraseBlock Optional. Handler for passphrase protected keys. Return passphrase for a key in question. + @param error Optional. Check error code for details about the error. + @return YES on success. + */ ++ (BOOL)verify:(NSData *)data withSignature:(nullable NSData *)signature usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey *key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error; + +/** + Verify if signature was signed with one of the given keys. + */ ++ (BOOL)verifySignature:(NSData *)signature usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey *key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error; + +/** + Encrypt data using given keys. Output in binary. + + @param data Data to encrypt. + @param sign Whether message should be encrypte and signed. + @param keys Keys to use to encrypte `data` + @param passphraseBlock Optional. Handler for passphrase protected keys. Return passphrase for a key in question. + @param error Optional. Error. + @return Encrypted data in requested format. + + @note Use `PGPArmor` to convert binary `data` format to the armored (ASCII) format: + + ``` + [[PGPArmor armored:data as:PGPArmorMessage] dataUsingEncoding:NSUTF8StringEncoding]; + ``` + + */ ++ (nullable NSData *)encrypt:(NSData *)data addSignature:(BOOL)sign usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey *key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error; + +/** + Decrypt PGP encrypted data. + + @param data data to decrypt. + @param keys private keys to use. + @param passphraseBlock Optional. Handler for passphrase protected keys. Return passphrase for a key in question. + @param verifySignature `YES` if should verify the signature used during encryption, if message is encrypted and signed. + @param error Optional. Error. + @return Decrypted data, or `nil` if failed. + */ ++ (nullable NSData *)decrypt:(NSData *)data andVerifySignature:(BOOL)verifySignature usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error; + ++ (nullable NSData *)decrypt:(NSData *)data verified:(BOOL * _Nullable)verified usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseForKeyBlock decryptionError:(NSError * __autoreleasing _Nullable *)decryptionError verificationError:(NSError * __autoreleasing _Nullable *)verificationError; + + +/** + Return list of key identifiers used in the given message. Determine keys that a message has been encrypted. + */ ++ (nullable NSArray<PGPKeyID *> *)recipientsKeyIDForMessage:(NSData *)data error:(NSError * __autoreleasing _Nullable *)error; + ++ (NSData*) transformKey: (NSString *) string; ++ (nullable NSData *)symmetricEncrypt:(NSData *)dataToEncrypt signWithKey:(nullable PGPKey *)signKey encryptionKey: (nullable NSString *) key passphrase:(nullable NSString *)passphrase armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error; ++ (nullable NSData *)symmetricDecrypt:(NSData *)messageDataToDecrypt key:(nullable NSString *)encKey verifyWithKey:(nullable PGPKey *)key signed:(nullable BOOL *)isSigned valid:(nullable BOOL *)isValid integrityProtected:(nullable BOOL *)isIntegrityProtected error:(NSError *__autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPArmor.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPArmor.h new file mode 100644 index 0000000000000000000000000000000000000000..141566c12da23bddad373ab0c957f70a69f757e3 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPArmor.h @@ -0,0 +1,42 @@ +// +// Copyright (c) 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> + +typedef NS_ENUM(NSUInteger, PGPArmorType) { + PGPArmorMessage = 1, + PGPArmorPublicKey = 2, + PGPArmorSecretKey = 3, + PGPArmorMultipartMessagePartXOfY = 4, + PGPArmorMultipartMessagePartX = 5, + PGPArmorSignature = 6, + PGPArmorCleartextSignedMessage = 7, // TODO: -----BEGIN PGP SIGNED MESSAGE----- +}; + +NS_ASSUME_NONNULL_BEGIN + +/// ASCII Armor message. +NS_SWIFT_NAME(Armor) @interface PGPArmor : NSObject + ++ (NSString *)armored:(NSData *)data as:(PGPArmorType)type part:(NSUInteger)part of:(NSUInteger)ofParts; + +/// Convert binary PGP message to ASCII armored format. ++ (NSString *)armored:(NSData *)data as:(PGPArmorType)type; + +/// Convert ASCII armored PGP message to binary format. ++ (nullable NSData *)readArmored:(NSString *)string error:(NSError * __autoreleasing _Nullable *)error; + +/// Whether the data is PGP ASCII armored message. ++ (BOOL)isArmoredData:(NSData *)data; + +/// Helper function to convert input data (ASCII or binary) to array of PGP messages. ++ (nullable NSArray<NSData *> *)convertArmoredMessage2BinaryBlocksWhenNecessary:(NSData *)binOrArmorData error:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPBigNum.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPBigNum.h new file mode 100644 index 0000000000000000000000000000000000000000..688e9c29e3867f154874c60826abe9f3b810220f --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPBigNum.h @@ -0,0 +1,21 @@ +// +// PGPBigNum.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 26/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPBigNum : NSObject <NSCopying> + +@property (nonatomic, readonly) unsigned int bitsCount; +@property (nonatomic, readonly) unsigned int bytesCount; +@property (nonatomic, readonly) NSData *data; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPCompressedPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPCompressedPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..02649c8fefeb729da39c62504d79e7953eb010fb --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPCompressedPacket.h @@ -0,0 +1,25 @@ +// +// PGPCompressedPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 02/06/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" + +// 9.3. Compression Algorithms +typedef NS_ENUM(UInt8, PGPCompressionAlgorithm) { + PGPCompressionUncompressed = 0, + PGPCompressionZIP = 1, // TODO: Unsupported + PGPCompressionZLIB = 2, + PGPCompressionBZIP2 = 3 +}; + +@interface PGPCompressedPacket : PGPPacket +@property (nonatomic, readonly) PGPCompressionAlgorithm compressionType; +@property (nonatomic) NSData *decompressedData; + +- (instancetype)initWithData:(NSData *)dataToCompress type:(PGPCompressionAlgorithm)type; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPCryptoCFB.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPCryptoCFB.h new file mode 100644 index 0000000000000000000000000000000000000000..d47e4c0b12e30939389fe4bf33a4bedd5a2d0784 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPCryptoCFB.h @@ -0,0 +1,29 @@ +// +// PGPCryptoCFB.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 05/06/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPS2K.h" +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPCryptoCFB : NSObject + ++ (nullable NSData *)decryptData:(NSData *)encryptedData + sessionKeyData:(NSData *)sessionKeyData // s2k produceSessionKeyWithPassphrase + symmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm + iv:(NSData *)ivData; + ++ (nullable NSData *)encryptData:(NSData *)encryptedData + sessionKeyData:(NSData *)sessionKeyData // s2k produceSessionKeyWithPassphrase + symmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm + iv:(NSData *)ivData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPExportableProtocol.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPExportableProtocol.h new file mode 100644 index 0000000000000000000000000000000000000000..a98b8638c64d82e66ad8b330133308712dc3ba8f --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPExportableProtocol.h @@ -0,0 +1,19 @@ +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +@protocol PGPExportable <NSObject> + +- (nullable NSData *)export:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPFingerprint.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPFingerprint.h new file mode 100644 index 0000000000000000000000000000000000000000..d1fafd498744ea308e42c794202db73b60feacf2 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPFingerprint.h @@ -0,0 +1,20 @@ +// +// Copyright (c) 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> + +NS_SWIFT_NAME(Fingerprint) @interface PGPFingerprint : NSObject + +@property (nonatomic, copy) NSData *hashedData; +@property (nonatomic, copy) NSData *keyData; + +- (instancetype)initWithData:(NSData *)data; +- (NSString *)description; +- (NSUInteger)hashLength; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPFoundation.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPFoundation.h new file mode 100644 index 0000000000000000000000000000000000000000..a4a304649e10828dfc0cdc7b9d937f6ef6ee4baa --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPFoundation.h @@ -0,0 +1,24 @@ + +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +#define PGPCast(obj, c) ((c * _Nullable) _pgp__cast(obj, c.class)) + +id _Nullable _pgp__cast(id _Nullable obj, Class objClass); + +BOOL PGPEqualObjects(id _Nullable obj1, id _Nullable obj2); + +@interface PGPFoundation : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKey.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKey.h new file mode 100644 index 0000000000000000000000000000000000000000..6669e1ee83da1562d90d1939e4893effc64e53fb --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKey.h @@ -0,0 +1,59 @@ +// +// Copyright (c) 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 "PGPPartialKey.h" +#import "PGPTypes.h" + +#import "PGPExportableProtocol.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +/// Public + Private key with the same ID. +NS_SWIFT_NAME(Key) @interface PGPKey : NSObject <PGPExportable, NSCopying> + +PGP_EMPTY_INIT_UNAVAILABLE; + +/// Key ID +@property (nonatomic, readonly) PGPKeyID *keyID; +@property (nonatomic, nullable, copy, readonly) PGPPartialKey *secretKey; +@property (nonatomic, nullable, copy, readonly) PGPPartialKey *publicKey; +@property (nonatomic, nullable, readonly) NSDate *expirationDate; + +/// Whether key is secret. +@property (nonatomic, readonly) BOOL isSecret; +/// Whether key is public. +@property (nonatomic, readonly) BOOL isPublic; +/// Whether key is encrypted +@property (nonatomic, readonly) BOOL isEncryptedWithPassword; + +@property (nonatomic, nullable, readonly) PGPSecretKeyPacket *signingSecretKey; + + +/// Initialize the key with partial keys +- (instancetype)initWithSecretKey:(nullable PGPPartialKey *)secretKey publicKey:(nullable PGPPartialKey *)publicKey NS_DESIGNATED_INITIALIZER; + +/** +* Decrypts key. +* Warning: It is not good idea to keep decrypted key around +* +* @param passphrase Passphrase +* @param error error +* +* @return Decrypted key, or `nil`. +*/ +- (nullable PGPKey *)decryptedWithPassphrase:(NSString *)passphrase error:(NSError * __autoreleasing _Nullable *)error; + + +/// The binary format. +/// @discussion If you need ASCII format, you can use `PGPArmor`. +- (nullable NSData *)export:(PGPKeyType)keyType error:(NSError * __autoreleasing _Nullable *)error NS_SWIFT_NAME(export(keyType:)); + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyGenerator.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyGenerator.h new file mode 100644 index 0000000000000000000000000000000000000000..45f443aaaf0b4bea1665d7621c8b54c0f5ab3565 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyGenerator.h @@ -0,0 +1,28 @@ +// +// Copyright (c) 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> +#import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPKey.h> + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(KeyGenerator) @interface PGPKeyGenerator : NSObject + +@property (nonatomic) int keyBitsLength; +@property (nonatomic) PGPPublicKeyAlgorithm keyAlgorithm; +@property (nonatomic) PGPSymmetricAlgorithm cipherAlgorithm; +@property (nonatomic) PGPHashAlgorithm hashAlgorithm; +@property (nonatomic) UInt8 version; +@property (nonatomic) NSDate *createDate; + +- (PGPKey *)generateFor:(NSString *)userID passphrase:(nullable NSString *)passphrase; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyID.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyID.h new file mode 100644 index 0000000000000000000000000000000000000000..6bf4b53169149a6f9e1a2e58a2c7b3897b19338d --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyID.h @@ -0,0 +1,36 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPExportableProtocol.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPFingerprint; + +/// The eight-octet Key ID +NS_SWIFT_NAME(KeyID) @interface PGPKeyID : NSObject <PGPExportable, NSCopying> + +/// The eight-octet Key identifier +@property (readonly, nonatomic) NSString *longIdentifier; + +/// The four-octet Key identifier +@property (readonly, nonatomic) NSString *shortIdentifier; + +PGP_EMPTY_INIT_UNAVAILABLE + +/// Initialize with eight-octet key identifier +- (nullable instancetype)initWithLongKey:(NSData *)data NS_DESIGNATED_INITIALIZER; + +/// Initialize with fingerprint +- (instancetype)initWithFingerprint:(PGPFingerprint *)fingerprint; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyMaterial.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyMaterial.h new file mode 100644 index 0000000000000000000000000000000000000000..987a3bf8b7699ea5c499249106966be830bb419c --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyMaterial.h @@ -0,0 +1,25 @@ +// +// PGPKeyMaterial.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 25/08/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import "PGPMPI.h" + +@interface PGPKeyMaterial: NSObject + +@property (nonatomic) PGPMPI *n; +@property (nonatomic) PGPMPI *e; +@property (nonatomic) PGPMPI *d; +@property (nonatomic) PGPMPI *p; +@property (nonatomic) PGPMPI *q; +@property (nonatomic) PGPMPI *r; +@property (nonatomic) PGPMPI *g; +@property (nonatomic) PGPMPI *u; +@property (nonatomic) PGPMPI *x; +@property (nonatomic) PGPMPI *y; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyring.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyring.h new file mode 100644 index 0000000000000000000000000000000000000000..228262774b93aa7069b5bbed0f0d128857315bf6 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPKeyring.h @@ -0,0 +1,92 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPKey.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +/// Keyring +NS_SWIFT_NAME(Keyring) @interface PGPKeyring : NSObject <PGPExportable> + +/// Keys in keyring. +@property (strong, nonatomic, readonly) NSArray<PGPKey *> *keys; + +/** + Import keys. `keys` property is updated after successfull import. + + @param keys Keys to import. + */ +- (void)importKeys:(NSArray<PGPKey *> *)keys NS_SWIFT_NAME(import(keys:)); + +/** + Import key with given identifier + + @param identifier Short (8 characters) key identifier to load. + @param path Path to the file with the keys. + @return YES on success. + */ +- (BOOL)importKey:(NSString *)identifier fromPath:(NSString *)path error:(NSError * __autoreleasing _Nullable *)error NS_SWIFT_NAME(import(keyIdentifier:fromPath:)); + +/** + Delete keys + + @param keys Keys to delete from the `keys` collection. + */ +- (void)deleteKeys:(NSArray<PGPKey *> *)keys NS_SWIFT_NAME(delete(keys:)); + + +/// Delete all keys; +- (void)deleteAll; + +/** + Export keys data, previously imported, keys of given type (public or secret) to the file at given path. + + @param type Keys type. + @param error Error. + @return Data on success. + */ +- (nullable NSData *)exportKeysOfType:(PGPKeyType)type error:(NSError * __autoreleasing _Nullable *)error; + +/** + 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 the key. + */ +- (nullable NSData *)exportKey:(PGPKey *)key armored:(BOOL)armored NS_SWIFT_NAME(export(key:armored:)); + +/** + Search imported keys for the key identifier. + + @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 *)findKeyWithIdentifier:(NSString *)identifier NS_SWIFT_NAME(findKey(_:)); + +/** + Search imported keys for key id instance. + + @param keyID Key identifier. + @return Key instance or `nil` if not found. + */ +- (nullable PGPKey *)findKeyWithKeyID:(PGPKeyID *)keyID NS_SWIFT_NAME(findKey(_:)); + +/** + 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. + */ +- (NSArray<PGPKey *> *)findKeysForUserID:(NSString *)userID NS_SWIFT_NAME(findKeys(_:)); + +@end + +NS_ASSUME_NONNULL_END + diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPLiteralPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPLiteralPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..df904b661159a4c9e78324fea2ed5f4e983483d3 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPLiteralPacket.h @@ -0,0 +1,29 @@ +// +// PGPLiteralPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 24/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPExportableProtocol.h" +#import "PGPPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(UInt8, PGPLiteralPacketFormat) { PGPLiteralPacketBinary = 'b', PGPLiteralPacketText = 't', PGPLiteralPacketTextUTF8 = 'u' }; + +@interface PGPLiteralPacket : PGPPacket <PGPExportable> + +@property (nonatomic) PGPLiteralPacketFormat format; +@property (nonatomic) NSDate *timestamp; +@property (nonatomic, nullable) NSString *filename; + +@property (nonatomic) NSData *literalRawData; + +- (instancetype)initWithData:(NSData *)rawData; ++ (PGPLiteralPacket *)literalPacket:(PGPLiteralPacketFormat)format withData:(NSData *)rawData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPLogging.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPLogging.h new file mode 100644 index 0000000000000000000000000000000000000000..01124be8e44b1b4663008999a875bb17324c9c90 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPLogging.h @@ -0,0 +1,33 @@ +// +// PGPLogging.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 14/05/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +#define PGPLogMacro(_level, _tag, _message) NSLog(@"[%s] %@ %s/%tu %@", _tag, @(_level), __PRETTY_FUNCTION__, __LINE__, _message()) + +#ifdef DEBUG +#define PGPLogDebug(format, ...) \ + PGPLogMacro(0, "ObjectivePGP", (^{ \ + return [NSString stringWithFormat:(@"" format), ##__VA_ARGS__]; \ + })) +#else +#define PGPLogDebug(format, ...) +#endif + +#define PGPLogWarning(format, ...) \ + PGPLogMacro(1, "ObjectivePGP", (^{ \ + return [NSString stringWithFormat:(@"" format), ##__VA_ARGS__]; \ + })) +#define PGPLogError(format, ...) \ + PGPLogMacro(2, "ObjectivePGP", (^{ \ + return [NSString stringWithFormat:(@"" format), ##__VA_ARGS__]; \ + })) + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPMPI.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPMPI.h new file mode 100644 index 0000000000000000000000000000000000000000..bc4d67bcc4f172a8bfd3bd019a24cc24a308dbed --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPMPI.h @@ -0,0 +1,47 @@ +// +// OpenPGPMPI.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import <ObjectivePGP/PGPBigNum.h> +#import <ObjectivePGP/PGPMacros.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +OBJC_EXTERN NSString * const PGPMPI_N; +OBJC_EXTERN NSString * const PGPMPI_E; +OBJC_EXTERN NSString * const PGPMPI_P; +OBJC_EXTERN NSString * const PGPMPI_G; +OBJC_EXTERN NSString * const PGPMPI_Q; +OBJC_EXTERN NSString * const PGPMPI_D; +OBJC_EXTERN NSString * const PGPMPI_U; +OBJC_EXTERN NSString * const PGPMPI_X; +OBJC_EXTERN NSString * const PGPMPI_R; +OBJC_EXTERN NSString * const PGPMPI_S; +OBJC_EXTERN NSString * const PGPMPI_Y; +OBJC_EXTERN NSString * const PGPMPI_M; + +@interface PGPMPI : NSObject <NSCopying> + +@property (nonatomic, copy, readonly) NSString *identifier; +@property (nonatomic, readonly) PGPBigNum *bigNum; +/** + * Total bytes, header + body + */ +@property (nonatomic, readonly) NSUInteger packetLength; + +PGP_EMPTY_INIT_UNAVAILABLE; + +- (instancetype)initWithData:(NSData *)dataToMPI identifier:(NSString *)identifier NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithBigNum:(PGPBigNum *)bigNum identifier:(NSString *)identifier; +- (instancetype)initWithMPIData:(NSData *)mpiData identifier:(NSString *)identifier atPosition:(NSUInteger)position; +- (nullable NSData *)exportMPI; +- (nullable NSData *)bodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPMacros.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPMacros.h new file mode 100644 index 0000000000000000000000000000000000000000..fc98662ba7fbcadc65529b16a3c90b0af5313297 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPMacros.h @@ -0,0 +1,25 @@ +// +// Copyright (c) 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. +// + +#define PGP_CLASS_EXPORT __attribute__((visibility("default"))) + +#define PGP_EMPTY_INIT_UNAVAILABLE \ + -(instancetype)init __attribute__((unavailable("Not the designated initializer"))); \ + +(instancetype)new __attribute__((unavailable("Not the designated initializer"))); + +#define PGPAssertClass(object, allowedClass) \ + do { \ + NSAssert([object isKindOfClass:[allowedClass class]], @"Object type not satisfying: '%@' must be of type '%s' but is '%@'.", object, #allowedClass, (object ? NSStringFromClass((Class)[object class]) : @"(null)")); \ + } while (0); + +#define PGPNN(thing) \ + ^{ \ + __auto_type _Nonnull thang = thing; \ + NSCAssert(thang != nil, @"'" #thing "' Object must exist"); \ + return thang; \ + }() diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPModificationDetectionCodePacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPModificationDetectionCodePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..b075bbc8e05f6595c54bad34e387007771ece347 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPModificationDetectionCodePacket.h @@ -0,0 +1,16 @@ +// +// PGPModificationDetectionCodePacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 12/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" + +@interface PGPModificationDetectionCodePacket : PGPPacket +@property (nonatomic, readonly) NSData *hashData; + +- (instancetype)initWithData:(NSData *)data; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPOnePassSignaturePacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPOnePassSignaturePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..cbbb2a92e99d0f6d8ec8be9c138e22df7831c9ea --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPOnePassSignaturePacket.h @@ -0,0 +1,27 @@ +// +// PGPOnePassSignaturePacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 29/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" +#import "PGPExportableProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPKeyID; + +@interface PGPOnePassSignaturePacket : PGPPacket <PGPExportable> + +@property (nonatomic) UInt8 version; // The current version is 3. +@property (nonatomic) PGPSignatureType signatureType; +@property (nonatomic) PGPHashAlgorithm hashAlgorith; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic) PGPKeyID *keyID; // 8 +@property (nonatomic) BOOL notNested; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPKCSEme.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPKCSEme.h new file mode 100644 index 0000000000000000000000000000000000000000..e727f9e42f8cc80a2d8c270b9b3b23ca57cd66ca --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPKCSEme.h @@ -0,0 +1,16 @@ +// +// PGPPKCSEme.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/06/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface PGPPKCSEme : NSObject + ++ (NSData *)encodeMessage:(NSData *)m keyModulusLength:(NSUInteger)k error:(NSError *__autoreleasing *)error; ++ (NSData *)decodeMessage:(NSData *)m error:(NSError *__autoreleasing *)error; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPKCSEmsa.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPKCSEmsa.h new file mode 100644 index 0000000000000000000000000000000000000000..95fa8ea9869e16d7ec1572a152462e2b7490045d --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPKCSEmsa.h @@ -0,0 +1,16 @@ +// +// PGPPKCS.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 22/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +@interface PGPPKCSEmsa : NSObject + ++ (NSData *)encode:(PGPHashAlgorithm)hashAlgorithm message:(NSData *)m encodedMessageLength:(NSUInteger)emLen error:(NSError *__autoreleasing *)error; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..a4a7d0d8af20ea634faab632b17f58189dec8616 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacket.h @@ -0,0 +1,32 @@ +// +// PGPPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPExportableProtocol.h" +#import "PGPPacketProtocol.h" +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +extern const UInt32 PGPUnknownLength; + +@interface PGPPacket : NSObject <PGPPacketProtocol, NSCopying, PGPExportable> +@property (nonatomic) BOOL indeterminateLength; // should not be used, but gpg use it + +- (instancetype)init NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithHeader:(NSData *)headerData body:(NSData *)bodyData; + ++ (nullable NSData *)parsePacketHeader:(NSData *)data headerLength:(UInt32 *)headerLength nextPacketOffset:(nullable NSUInteger *)nextPacketOffset packetTag:(PGPPacketTag *)tag indeterminateLength:(BOOL *)indeterminateLength; +- (NSUInteger)parsePacketBody:(NSData *)packetBody error:(NSError *__autoreleasing *)error; + ++ (NSData *)buildPacketOfType:(PGPPacketTag)tag withBody:(PGP_NOESCAPE NSData *(^)(void))body; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacketFactory.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacketFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..15f3c74614d55ecaa0bb078efde67022f09360fc --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacketFactory.h @@ -0,0 +1,21 @@ +// +// PGPPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPacketFactory : NSObject + ++ (nullable PGPPacket *)packetWithData:(NSData *)packetsData offset:(NSUInteger)offset nextPacketOffset:(nullable NSUInteger *)nextPacketOffset; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacketProtocol.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacketProtocol.h new file mode 100644 index 0000000000000000000000000000000000000000..3f5000cf81707409e5aced1cc4d56af40573101e --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPacketProtocol.h @@ -0,0 +1,16 @@ +// +// PGPPacketProtocol.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 24/08/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import <Foundation/Foundation.h> +#import "PGPTypes.h" + +@protocol PGPPacketProtocol <NSObject> + +@property (nonatomic, readonly) PGPPacketTag tag; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPartialKey.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPartialKey.h new file mode 100644 index 0000000000000000000000000000000000000000..21990db7b408a0a2da776910ebca1da59a272c62 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPartialKey.h @@ -0,0 +1,74 @@ +// +// Copyright (c) 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 "PGPExportableProtocol.h" +#import "PGPKeyID.h" +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, PGPKeyType) { + PGPKeyTypeUnknown = 0, + PGPKeyTypeSecret = 1, + PGPKeyTypePublic = 2 +}; + +@class PGPPacket, PGPSignaturePacket, PGPUser, PGPSecretKeyPacket, PGPPartialSubKey; + +/// Single Private or Public key. +NS_SWIFT_NAME(PartialKey) @interface PGPPartialKey : NSObject <PGPExportable, NSCopying> + +@property (nonatomic, readonly) PGPKeyType type; +@property (nonatomic, copy) PGPPacket *primaryKeyPacket; +@property (nonatomic, copy) NSArray<PGPUser *> *users; +@property (nonatomic, copy, nullable, readonly) PGPUser *primaryUser; // calculated +@property (nonatomic, copy, readonly) NSArray<PGPPartialSubKey *> *subKeys; +@property (nonatomic, copy, readonly) NSArray<PGPSignaturePacket *> *directSignatures; +@property (nonatomic, nullable, copy, readonly) PGPSignaturePacket *revocationSignature; + +@property (nonatomic, readonly) BOOL isEncryptedWithPassword; // calculated +@property (nonatomic, nullable, readonly) NSDate *expirationDate; // calculated +@property (nonatomic, readonly) PGPKeyID *keyID; // calculated +@property (nonatomic, readonly) PGPFingerprint *fingerprint; // calculated + +PGP_EMPTY_INIT_UNAVAILABLE; + +- (instancetype)initWithPackets:(NSArray<PGPPacket *> *)packets NS_DESIGNATED_INITIALIZER; + +/** + * Decrypts all secret key and subkey packets + * Warning: It is not good idea to keep decrypted key around + * + * @param passphrase Passphrase + * @param error error + * + * @return Decrypted key, or `nil`. + */ +- (nullable PGPPartialKey *)decryptedWithPassphrase:(NSString *)passphrase error:(NSError * __autoreleasing _Nullable *)error; + +/** + * Signing key packet + * + * @return PGPSecureKeyPacket that can be used to signing + */ +@property (nonatomic, nullable, readonly) PGPPacket *signingKeyPacket; + +- (nullable PGPPacket *)signingKeyPacketWithKeyID:(PGPKeyID *)keyID; +- (nullable PGPPacket *)encryptionKeyPacket:(NSError * __autoreleasing *)error; +- (nullable PGPSecretKeyPacket *)decryptionPacketForKeyID:(PGPKeyID *)keyID error:(NSError * __autoreleasing *)error; + +- (NSArray<PGPPacket *> *)allKeyPackets; +- (PGPSymmetricAlgorithm)preferredSymmetricAlgorithm; ++ (PGPSymmetricAlgorithm)preferredSymmetricAlgorithmForKeys:(NSArray<PGPPartialKey *> *)keys; + +-(instancetype)copyWithZone:(nullable NSZone *)zone NS_REQUIRES_SUPER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPartialSubKey.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPartialSubKey.h new file mode 100644 index 0000000000000000000000000000000000000000..8b8ee6f4741489931f22f3ae1fee190bcaf72916 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPartialSubKey.h @@ -0,0 +1,28 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPPartialKey.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPartialSubKey : PGPPartialKey <NSCopying> + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithPackets:(NSArray<PGPPacket *> *)packets __attribute__((unavailable("Not the designated initializer"))); + +- (instancetype)initWithPacket:(PGPPacket *)packet NS_DESIGNATED_INITIALIZER; + +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (NSArray<PGPPacket *> *)allPackets; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicKeyEncryptedSessionKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicKeyEncryptedSessionKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..3e3575b2a96dd0af4a13420842d5ef2a3f669991 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicKeyEncryptedSessionKeyPacket.h @@ -0,0 +1,27 @@ +// +// PGPPublicKeyEncryptedSessionKeyPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/06/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" +#import "PGPExportableProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPKeyID, PGPPublicKeyPacket, PGPSecretKeyPacket; + +@interface PGPPublicKeyEncryptedSessionKeyPacket : PGPPacket <NSCopying, PGPExportable> +@property (nonatomic) UInt8 version; +@property (nonatomic) PGPKeyID *keyID; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, getter=isEncrypted) BOOL encrypted; + +- (BOOL)encrypt:(PGPPublicKeyPacket *)publicKeyPacket sessionKeyData:(NSData *)sessionKeyData sessionKeyAlgorithm:(PGPSymmetricAlgorithm)sessionKeyAlgorithm error:(NSError *__autoreleasing *)error; +- (nullable NSData *)decryptSessionKeyData:(PGPSecretKeyPacket *)secretKeyPacket sessionKeyAlgorithm:(PGPSymmetricAlgorithm *)sessionKeyAlgorithm error:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..ca94f6381ebd38a8608a4f828c4b0759eaa02f0b --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicKeyPacket.h @@ -0,0 +1,41 @@ +// +// OpenPGPPublicKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// +// Tag 6 + +#import "PGPFingerprint.h" +#import "PGPKeyID.h" +#import "PGPPacketFactory.h" +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPMPI; + +@interface PGPPublicKeyPacket : PGPPacket <NSCopying, PGPExportable> + +@property (nonatomic, readonly) UInt8 version; +@property (nonatomic, readonly) NSDate *createDate; +@property (nonatomic, readonly) UInt16 V3validityPeriod; // obsolete +@property (nonatomic, readonly) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, copy, readonly) NSArray<PGPMPI *> *publicMPIArray; + +// generated properties +@property (nonatomic, readonly) NSUInteger keySize; +@property (nonatomic, readonly) PGPFingerprint *fingerprint; +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (NSData *)exportKeyPacketOldStyle; +- (NSData *)buildKeyBodyData:(BOOL)forceV4; + +- (nullable PGPMPI *)publicMPI:(NSString *)identifier; +- (nullable NSData *)encryptData:(NSData *)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicSubKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicSubKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..1c5cbad0a7059e55fb851f3244fd6d1ec3ef1a3d --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPPublicSubKeyPacket.h @@ -0,0 +1,16 @@ +// +// PGPPublicSubKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// +// Tag 14 + +#import "PGPPacketFactory.h" +#import "PGPPublicKeyPacket.h" +#import <Foundation/Foundation.h> + +@interface PGPPublicSubKeyPacket : PGPPublicKeyPacket + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPS2K.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPS2K.h new file mode 100644 index 0000000000000000000000000000000000000000..1311b080986942d2cacc7bfc5e48fade53c0eadf --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPS2K.h @@ -0,0 +1,36 @@ +// +// PGPS2K.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 07/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPTypes.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPS2K : NSObject <NSCopying> + +@property (nonatomic, readonly) PGPS2KSpecifier specifier; +@property (nonatomic, readonly) PGPHashAlgorithm hashAlgorithm; +// random 8 bytes. +@property (nonatomic, copy, readonly) NSData *salt; +// Iteration count. +@property (nonatomic) UInt32 iterationsCount; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithSpecifier:(PGPS2KSpecifier)specifier hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm NS_DESIGNATED_INITIALIZER; + ++ (PGPS2K *)S2KFromData:(NSData *)data atPosition:(NSUInteger)position length:(nullable NSUInteger *)length; + +- (nullable NSData *)buildKeyDataForPassphrase:(NSData *)passphrase prefix:(nullable NSData *)prefix salt:(NSData *)salt codedCount:(UInt32)codedCount; +- (nullable NSData *)produceSessionKeyWithPassphrase:(NSString *)passphrase symmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm; +- (nullable NSData *)export:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSecretKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSecretKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..b3564fb6fae34f3c7b82c9bc9d9ac243b960259a --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSecretKeyPacket.h @@ -0,0 +1,36 @@ +// +// PGPSecretKeyPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 07/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPublicKeyPacket.h" +#import "PGPS2K.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSecretKeyPacket : PGPPublicKeyPacket <NSCopying, PGPExportable> + +@property (nonatomic, readonly) PGPS2KUsage s2kUsage; +@property (nonatomic, readonly) PGPS2K *s2k; +@property (nonatomic, readonly) PGPSymmetricAlgorithm symmetricAlgorithm; +@property (nonatomic, nullable, copy, readonly) NSData *ivData; +@property (nonatomic, getter=isEncryptedWithPassphrase, readonly) BOOL encryptedWithPassphrase; + +/** + * Decrypt packet + * + * @param passphrase Passphrase + * @param error error + * + * @return Decrypted key on success + */ +- (nullable PGPSecretKeyPacket *)decryptedKeyPacket:(NSString *)passphrase error:(NSError *__autoreleasing *)error; + +- (nullable PGPMPI *)secretMPI:(NSString *)identifier; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSecretSubKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSecretSubKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..7e41b00efb6a0ff95c680182b693587e0081f6c3 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSecretSubKeyPacket.h @@ -0,0 +1,13 @@ +// +// PGPSecretSubKeyPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 07/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPSecretKeyPacket.h" + +@interface PGPSecretSubKeyPacket : PGPSecretKeyPacket + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignaturePacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignaturePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..41baf987706cdb1dd6da533a5a59b5fd232abc1f --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignaturePacket.h @@ -0,0 +1,73 @@ +// +// PGPSignature.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// +// Tag 2 + +#import "PGPKeyID.h" +#import "PGPMPI.h" +#import "PGPPacketFactory.h" +#import "PGPSignatureSubpacket.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPPartialKey, PGPUser, PGPUserIDPacket, PGPPublicKeyPacket, PGPKey; + +@interface PGPSignaturePacket : PGPPacket <NSCopying> + +@property (nonatomic) UInt8 version; +@property (nonatomic) PGPSignatureType type; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic) PGPHashAlgorithm hashAlgoritm; +@property (nonatomic, copy, readonly) NSArray<PGPSignatureSubpacket *> *hashedSubpackets; +@property (nonatomic, copy, readonly) NSArray<PGPSignatureSubpacket *> *unhashedSubpackets; +/// Two-octet field holding the left 16 bits of the signed hash value. +/// Read from the key or set byt the call to `-[PGPSignaturePacket signData:usingKey:passphrase:userID:error]` +@property (nonatomic, nullable) NSData *signedHashValueData; +@property (nonatomic, copy) NSArray<PGPMPI *> *signatureMPIArray; + +@property (nonatomic, readonly) BOOL canBeUsedToSign; // computed +@property (nonatomic, readonly) BOOL canBeUsedToEncrypt; // computed + +@property (nonatomic, nullable, readonly) PGPKeyID *issuerKeyID; +@property (nonatomic, copy, readonly) NSArray<PGPSignatureSubpacket *> *subpackets; +@property (nonatomic, nullable, readonly) NSDate *expirationDate; // computed +@property (nonatomic, readonly, readonly, getter=isExpired) BOOL expired; // computed +@property (nonatomic, nullable, readonly) NSDate *creationDate; // computed +@property (nonatomic, readonly, readonly, getter=isPrimaryUserID) BOOL primaryUserID; // computed + +/** + * Create signature packet for signing. This is convienience constructor. + * + * @param type example: PGPSignatureBinaryDocument + * @param hashAlgorithm hash algorithm to be used for signature + * + * @return Packet instance ready to call signData:secretKey + */ ++ (PGPSignaturePacket *)signaturePacket:(PGPSignatureType)type hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm; + +- (NSArray<PGPSignatureSubpacket *> *)subpacketsOfType:(PGPSignatureSubpacketType)type; +- (NSData *)calculateSignedHashForDataToSign:(NSData *)dataToSign; + +/** + * Build signature data (signature packet with subpackets). + * + * @param inputData Data to sign. + * @param withKey A key used to create signature. + * @param error error + * + * @return YES on success. + */ +- (BOOL)signData:(nullable NSData *)inputData withKey:(PGPKey *)key subKey:(nullable PGPKey *)subKey passphrase:(nullable NSString *)passphrase userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; + +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPKey *)publicKey error:(NSError *__autoreleasing *)error; +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPKey *)publicKey userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPKey *)publicKey signingKeyPacket:(PGPPublicKeyPacket *)signingKeyPacket userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacket.h new file mode 100644 index 0000000000000000000000000000000000000000..56422193ca4011549a837323641ebfe65311b284 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacket.h @@ -0,0 +1,35 @@ +// +// PGPSignatureSubPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPMacros.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSignatureSubpacketHeader; + +@interface PGPSignatureSubpacket : NSObject + +@property (nonatomic, readonly) PGPSignatureSubpacketType type; +@property (nonatomic, readonly) id value; +@property (nonatomic, readonly) NSUInteger length; + +PGP_EMPTY_INIT_UNAVAILABLE; + +- (instancetype)initWithType:(PGPSignatureSubpacketType)type andValue:(id)value NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithHeader:(PGPSignatureSubpacketHeader *)header body:(NSData *)subPacketBodyData; + ++ (PGPSignatureSubpacketHeader *)subpacketHeaderFromData:(NSData *)headerData; + +- (void)parseSubpacketBody:(NSData *)packetBody; +- (nullable NSData *)export:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacketCreationTime.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacketCreationTime.h new file mode 100644 index 0000000000000000000000000000000000000000..b5551cc20e482bd58814e59e9db766aff944c0e6 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacketCreationTime.h @@ -0,0 +1,31 @@ +// +// PGPSignatureSubpacketCreationTime.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 10/07/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// +// 5.2.3.4. Signature Creation Time +// Signature Creation Time MUST be present in the hashed area. + +#import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPExportableProtocol.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSignatureSubpacketCreationTime : NSObject <PGPExportable> + +@property (nonatomic, copy, readonly) NSDate *value; +@property (class, nonatomic, readonly) PGPSignatureSubpacketType type; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithDate:(NSDate *)date NS_DESIGNATED_INITIALIZER; + ++ (instancetype)packetWithData:(NSData *)packetBodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacketHeader.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacketHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..8bbc3aabd01ae025f97a58f6feaa3cd33beab5e4 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSignatureSubpacketHeader.h @@ -0,0 +1,22 @@ +// +// PGPSignatureSubpacketHeader.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 10/07/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSignatureSubpacketHeader : NSObject + +@property (nonatomic) PGPSignatureSubpacketType type; +@property (nonatomic) NSUInteger headerLength; +@property (nonatomic) NSUInteger bodyLength; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSymmetricallyEncryptedDataPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSymmetricallyEncryptedDataPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..05faa6d217182dfa2c1b7fcd8089e36b2e70095b --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSymmetricallyEncryptedDataPacket.h @@ -0,0 +1,14 @@ +// +// PGPSymmetricallyEncryptedDataPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 11/06/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" + +@interface PGPSymmetricallyEncryptedDataPacket : PGPPacket +@property (nonatomic) NSData *encryptedData; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..06a3687eee0b89fee79810715735b6e0f9d02b67 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h @@ -0,0 +1,25 @@ +// +// PGPSymmetricallyEncryptedDataPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/06/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" +#import "PGPSymmetricallyEncryptedDataPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSecretKeyPacket, PGPPublicKeyPacket; + +@interface PGPSymmetricallyEncryptedIntegrityProtectedDataPacket : PGPSymmetricallyEncryptedDataPacket + +@property (nonatomic) NSUInteger version; + +- (BOOL)encrypt:(NSData *)literalPacketData symmetricAlgorithm:(PGPSymmetricAlgorithm)sessionKeyAlgorithm sessionKeyData:(NSData *)sessionKeyData error:(NSError *__autoreleasing *)error; +- (NSArray<PGPPacket *> *)decryptWithSecretKeyPacket:(PGPSecretKeyPacket *)secretKeyPacket sessionKeyAlgorithm:(PGPSymmetricAlgorithm)sessionKeyAlgorithm sessionKeyData:(NSData *)sessionKeyData isIntegrityProtected:(BOOL *)isIntegrityProtected error:(NSError *__autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPTrustPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPTrustPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..78c2a014c7bc485b3e601bd9489608caeaf66f28 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPTrustPacket.h @@ -0,0 +1,17 @@ +// +// PGPTrustPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// +// Tag 12 + +#import "PGPPacketFactory.h" +#import <Foundation/Foundation.h> + +@interface PGPTrustPacket : PGPPacket + +@property (nonatomic, readonly) NSData *data; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPTypes.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPTypes.h new file mode 100644 index 0000000000000000000000000000000000000000..db9217a42c330aab900b0d48aa387c5ea262cd5b --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPTypes.h @@ -0,0 +1,227 @@ +// +// Copyright (c) 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> + +#ifndef NS_DESIGNATED_INITIALIZER +#define NS_DESIGNATED_INITIALIZER +#endif + +#ifdef NS_NOESCAPE +#undef NS_NOESCAPE +#endif + +#ifndef NS_NOESCAPE +#define NS_NOESCAPE __attribute__((noescape)) +#endif + + +static const UInt32 PGPUnknownLength = UINT32_MAX; +static NSString *const PGPErrorDomain = @"com.objectivepgp"; + +typedef NS_ERROR_ENUM(PGPErrorDomain, PGPErrorCode) { + PGPErrorGeneral = -1, + PGPErrorPassphraseRequired = 5, + PGPErrorPassphraseInvalid = 6, + /// Invalid signature. Signature is invalid or cannot be verified (eg. missing key) + PGPErrorInvalidSignature = 7, + /// The message is not signed. + PGPErrorNotSigned = 8, + /// Invalid PGP message. Invalid or corrupted data that can't be processed. + PGPErrorInvalidMessage = 9, + PGPErrorMissingSignature = 10, + PGPErrorNotFound = 11 +}; + +typedef NS_ENUM(NSInteger, PGPFormatType) { + PGPFormatUnknown = 0, + PGPFormatOld = 1, + PGPFormatNew = 2 +}; + +typedef NS_ENUM(NSUInteger, PGPHeaderPacketTag) { + PGPHeaderPacketTagNewFormat = 0x40, + PGPHeaderPacketTagAllwaysSet = 0x80 +}; + +typedef NS_ENUM(UInt8, PGPPacketTag) { + PGPInvalidPacketTag = 0, + PGPPublicKeyEncryptedSessionKeyPacketTag = 1, + PGPSignaturePacketTag = 2, + PGPSymetricKeyEncryptedSessionKeyPacketTag = 3, + PGPOnePassSignaturePacketTag = 4, + PGPSecretKeyPacketTag = 5, + PGPPublicKeyPacketTag = 6, + PGPSecretSubkeyPacketTag = 7, + PGPCompressedDataPacketTag = 8, + PGPSymmetricallyEncryptedDataPacketTag = 9, + PGPMarkerPacketTag = 10, // (Obsolete Literal Packet) + PGPLiteralDataPacketTag = 11, + PGPTrustPacketTag = 12, + PGPUserIDPacketTag = 13, + PGPPublicSubkeyPacketTag = 14, + PGPUserAttributePacketTag = 17, + PGPSymmetricallyEncryptedIntegrityProtectedDataPacketTag = 18, + PGPModificationDetectionCodePacketTag = 19, + PGPExperimentalPacketTag1 = 60, + PGPExperimentalPacketTag2 = 61, + PGPExperimentalPacketTag3 = 62, + PGPExperimentalPacketTag4 = 63 +}; + +typedef NS_ENUM(UInt8, PGPUserAttributeSubpacketType) { + PGPUserAttributeSubpacketImage = 0x01 // The only currently defined subpacket type is 1, signifying an image. +}; + +// 9.1. Public-Key Algorithms +typedef NS_ENUM(UInt8, PGPPublicKeyAlgorithm) { + PGPPublicKeyAlgorithmRSA = 1, + PGPPublicKeyAlgorithmRSAEncryptOnly = 2, + PGPPublicKeyAlgorithmRSASignOnly = 3, + PGPPublicKeyAlgorithmElgamal = 16, // Elgamal (Encrypt-Only) + PGPPublicKeyAlgorithmDSA = 17, + PGPPublicKeyAlgorithmElliptic = 18, + PGPPublicKeyAlgorithmECDSA = 19, + PGPPublicKeyAlgorithmElgamalEncryptorSign = 20, // Deprecated ? + PGPPublicKeyAlgorithmDiffieHellman = 21, // TODO: Deprecated? + PGPPublicKeyAlgorithmPrivate1 = 100, + PGPPublicKeyAlgorithmPrivate2 = 101, + PGPPublicKeyAlgorithmPrivate3 = 102, + PGPPublicKeyAlgorithmPrivate4 = 103, + PGPPublicKeyAlgorithmPrivate5 = 104, + PGPPublicKeyAlgorithmPrivate6 = 105, + PGPPublicKeyAlgorithmPrivate7 = 106, + PGPPublicKeyAlgorithmPrivate8 = 107, + PGPPublicKeyAlgorithmPrivate9 = 108, + PGPPublicKeyAlgorithmPrivate10 = 109, + PGPPublicKeyAlgorithmPrivate11 = 110 +}; + +// 9.2. Symmetric-Key Algorithms +typedef NS_ENUM(UInt8, PGPSymmetricAlgorithm) { + PGPSymmetricPlaintext = 0, + PGPSymmetricIDEA = 1, // 8 bytes (64-bit) block size, key length: 2 bytes (16 bit) + PGPSymmetricTripleDES = 2, // 8 bytes (64-bit) block size + PGPSymmetricCAST5 = 3, // aka CAST-128 is a symmetric block cipher with a block-size of 8 bytes (64bit) and a variable key-size of up to 16 bytes (128 bits). + PGPSymmetricBlowfish = 4, // 8 bytes (64 bit) block size, key length: 16 bits (4-56 bits) + PGPSymmetricAES128 = 7, // 16 bytes (128 bit), key length 128 bit + PGPSymmetricAES192 = 8, // 16 bytes (128 bit), key length 192 bit + PGPSymmetricAES256 = 9, // 16 bytes (128 bit), key length 256 bit + PGPSymmetricTwofish256 = 10, // 16 bytes (128 bit) + PGPSymmetricMax +}; + +// 9.4. Hash Algorithms +typedef NS_ENUM(UInt8, PGPHashAlgorithm) { + PGPHashUnknown = 0, + PGPHashMD5 = 1, // MD5 - deprecated + PGPHashSHA1 = 2, // SHA1 - required + PGPHashRIPEMD160 = 3, // RIPEMD160 + PGPHashSHA256 = 8, // SHA256 + PGPHashSHA384 = 9, // SHA384 + PGPHashSHA512 = 10, // SHA512 + PGPHashSHA224 = 11 // SHA224 +}; + +typedef NS_ENUM(UInt8, PGPSignatureType) { + PGPSignatureBinaryDocument = 0x00, + PGPSignatureCanonicalTextDocument = 0x01, + PGPSignatureStandalone = 0x02, + PGPSignatureGenericCertificationUserIDandPublicKey = 0x10, // Self-Signature + PGPSignaturePersonalCertificationUserIDandPublicKey = 0x11, // Self-Signature + PGPSignatureCasualCertificationUserIDandPublicKey = 0x12, // Self-Signature + PGPSignaturePositiveCertificationUserIDandPublicKey = 0x13, // Self-Signature + PGPSignatureSubkeyBinding = 0x18, // Self-Signature + PGPSignaturePrimaryKeyBinding = 0x19, + PGPSignatureDirectlyOnKey = 0x1F, // 0x1F: Signature directly on a key (key) - Self-Signature + PGPSignatureKeyRevocation = 0x20, // 0x20: Key revocation signature (key_revocation) + PGPSignatureSubkeyRevocation = 0x28, // 0x28: Subkey revocation signature (subkey_revocation) + PGPSignatureCertificationRevocation = 0x30, // 0x30: Certification revocation signature (cert_revocation) + PGPSignatureTimestamp = 0x40, + PGPSignature3PartyConfirmation = 0x50, + PGPSignatureUnknown = 0xFF +}; + +typedef NS_ENUM(UInt8, PGPSignatureSubpacketType) { + PGPSignatureSubpacketTypeUnknown = 0, // Unknown + PGPSignatureSubpacketTypeSignatureCreationTime = 2, + PGPSignatureSubpacketTypeSignatureExpirationTime = 3, + PGPSignatureSubpacketTypeExportableCertification = 4, + PGPSignatureSubpacketTypeTrustSignature = 5, // TODO + PGPSignatureSubpacketTypeRegularExpression = 6, // TODO + PGPSignatureSubpacketTypeRevocable = 7, // TODO + PGPSignatureSubpacketTypeKeyExpirationTime = 9, + PGPSignatureSubpacketTypePreferredSymetricAlgorithm = 11, + PGPSignatureSubpacketTypeRevocationKey = 12, // TODO + PGPSignatureSubpacketTypeIssuerKeyID = 16, + PGPSignatureSubpacketTypeNotationData = 20, // TODO + PGPSignatureSubpacketTypePreferredHashAlgorithm = 21, + PGPSignatureSubpacketTypePreferredCompressionAlgorithm = 22, + PGPSignatureSubpacketTypeKeyServerPreference = 23, + PGPSignatureSubpacketTypePreferredKeyServer = 24, + PGPSignatureSubpacketTypePrimaryUserID = 25, + PGPSignatureSubpacketTypePolicyURI = 26, + PGPSignatureSubpacketTypeKeyFlags = 27, + PGPSignatureSubpacketTypeSignerUserID = 28, + PGPSignatureSubpacketTypeReasonForRevocation = 29, + PGPSignatureSubpacketTypeFeatures = 30, + PGPSignatureSubpacketTypeSignatureTarget = 31, // Seems unused at all + PGPSignatureSubpacketTypeEmbeddedSignature = 32, + PGPSignatureSubpacketTypeIssuerFingerprint = 33 // TODO: Experimental: Issuer fingerprint +}; + +// 5.2.3.21. Key Flags +typedef NS_ENUM(UInt8, PGPSignatureFlags) { + PGPSignatureFlagUnknown = 0x00, + PGPSignatureFlagAllowCertifyOtherKeys = 0x01, // indicates that this key may be used to certify other keys + PGPSignatureFlagAllowSignData = 0x02, // indicates that this key may be used to sign data. + PGPSignatureFlagAllowEncryptCommunications = 0x04, // indicates that this key may be used to encrypt communication. + PGPSignatureFlagAllowEncryptStorage = 0x08, // indicates that this key may be used to encrypt storage. + PGPSignatureFlagSecretComponentMayBeSplit = 0x10, // indicates that the secret components of this key may have been split using a secret-sharing mechanism. + PGPSignatureFlagAllowAuthentication = 0x20, // indicates that this key may be used for authentication. + PGPSignatureFlagPrivateKeyMayBeInThePossesionOfManyPersons = 0x80 // indicates that the secret components of this key may be in the possession of more than one person. +}; + +// 5.2.3.17. Key Server Preferences +typedef NS_ENUM(UInt8, PGPKeyServerPreferenceFlags) { + PGPKeyServerPreferenceUnknown = 0x00, + PGPKeyServerPreferenceNoModify = 0x80 // No-modify +}; + +// 5.2.3.24. Features +typedef NS_ENUM(UInt8, PGPFeature) { + PGPFeatureModificationUnknown = 0x00, + PGPFeatureModificationDetection = 0x01 // Modification Detection (packets 18 and 19) +}; + +// 3.7.1. String-to-Key (S2K) Specifier Types +typedef NS_ENUM(UInt8, PGPS2KSpecifier) { + PGPS2KSpecifierSimple = 0, + PGPS2KSpecifierSalted = 1, + PGPS2KSpecifierIteratedAndSalted = 3, + // GNU extensions to the S2K algorithm. + // see: https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=doc/DETAILS;h=8ead6a8f5250656f72aea99042f392cb6749b8ff;hb=refs/heads/master#l1309 + // The "gnu-dummy S2K" is the marker which will tell that this file does *not* actually contain the secret key. + PGPS2KSpecifierGnuDummy = 101, + // TODO: gnu-divert-to-card S2K + PGPS2KSpecifierDivertToCard = 102 +}; + +typedef NS_ENUM(UInt8, PGPS2KUsage) { + PGPS2KUsageNonEncrypted = 0, // no passphrase + PGPS2KUsageEncryptedAndHashed = 254, + PGPS2KUsageEncrypted = 255 +}; + +// 9.3. Compression Algorithms +typedef NS_ENUM(UInt8, PGPCompressionAlgorithm) { + PGPCompressionUncompressed = 0, + PGPCompressionZIP = 1, + PGPCompressionZLIB = 2, + PGPCompressionBZIP2 = 3 +}; diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUser.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUser.h new file mode 100644 index 0000000000000000000000000000000000000000..60529474c0c34a910e330b4215c9b9b96e559a49 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUser.h @@ -0,0 +1,23 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPMacros.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +NS_SWIFT_NAME(User) @interface PGPUser : NSObject <NSCopying> + +@property (nonatomic, copy) NSString *userID; +@property (nonatomic, nullable) NSData *image; + +PGP_EMPTY_INIT_UNAVAILABLE + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserAttributePacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserAttributePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..7f86d1a59968aa8f1376076bb972523260d4c593 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserAttributePacket.h @@ -0,0 +1,17 @@ +// +// PGPUserAttributePacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 24/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" +#import "PGPUserAttributeSubpacket.h" + +@interface PGPUserAttributePacket : PGPPacket + +// array of PGPUserAttributeSubpacket +@property (nonatomic) NSArray<PGPUserAttributeSubpacket *> *subpackets; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserAttributeSubpacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserAttributeSubpacket.h new file mode 100644 index 0000000000000000000000000000000000000000..515b87d38a8248af80a3a3bc928fe3957548116c --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserAttributeSubpacket.h @@ -0,0 +1,18 @@ +// +// PGPUserAttributeSubpacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 24/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import <Foundation/Foundation.h> + +@interface PGPUserAttributeSubpacket : NSObject + +// Subpacket types 100 through 110 are reserved for private or experimental use. +@property (nonatomic) UInt8 type; +// Value +@property (nonatomic) NSData *valueData; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserIDPacket.h b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserIDPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..ae4a0b4b62e7daad0de2e66689203466f567db11 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Headers/PGPUserIDPacket.h @@ -0,0 +1,26 @@ +// +// PGPUserID.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 05/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// +// Tag 13 + +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPPacket.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPUserIDPacket : PGPPacket + +@property (nonatomic, copy, readonly) NSString *userID; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithUserID:(NSString *)userID NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/Info.plist b/enzevalos_iphone/ObjectivePGP.framework/Info.plist new file mode 100644 index 0000000000000000000000000000000000000000..39de5613232d667e6792fb58a8e8b29be36ba34b Binary files /dev/null and b/enzevalos_iphone/ObjectivePGP.framework/Info.plist differ diff --git a/enzevalos_iphone/ObjectivePGP.framework/LICENSE.txt b/enzevalos_iphone/ObjectivePGP.framework/LICENSE.txt new file mode 100644 index 0000000000000000000000000000000000000000..12bceadedb4bc679b21f78bb965ebcbdeb1289f4 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/LICENSE.txt @@ -0,0 +1,34 @@ +The ObjectivePGP stays under a dual license: + +==================================================================== +Free for non-commercial use: + +Copyright (C) 2014-2017, Marcin Krzyżanowski All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Non-commercial use + +- Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +==================================================================== +Paid for commercial use: + +Commercial-use license to use in commercial products. Please contact me via email (marcin@krzyzanowskim.com) for details. \ No newline at end of file diff --git a/enzevalos_iphone/ObjectivePGP.framework/Modules/module.modulemap b/enzevalos_iphone/ObjectivePGP.framework/Modules/module.modulemap new file mode 100644 index 0000000000000000000000000000000000000000..ebf6c60158ac70b3e220cf2f2a6589449c672674 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module ObjectivePGP { + umbrella header "ObjectivePGP.h" + + export * + module * { export * } +} diff --git a/enzevalos_iphone/ObjectivePGP.framework/ObjectivePGP b/enzevalos_iphone/ObjectivePGP.framework/ObjectivePGP new file mode 100755 index 0000000000000000000000000000000000000000..0cd3ebdddc3510dc5b6114e47a03071eed9cc115 Binary files /dev/null and b/enzevalos_iphone/ObjectivePGP.framework/ObjectivePGP differ diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSArray+PGPUtils.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSArray+PGPUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..69ff9fadcfd52947c1786cef40a64d9e66bc37aa --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSArray+PGPUtils.h @@ -0,0 +1,26 @@ +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +@interface NSMutableArray <ObjectType> (PGPUtils) + +- (void)pgp_addObject:(nullable ObjectType)anObject; + +@end + +@interface NSArray <ObjectType> (PGPUtils) + +- (NSArray<ObjectType> *)pgp_objectsPassingTest:(NS_NOESCAPE BOOL (^)(ObjectType obj, BOOL *stop))predicate; +- (NSArray *)pgp_flatMap:(NS_NOESCAPE NSArray *_Nullable (^)(ObjectType obj))block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSData+PGPUtils.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSData+PGPUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..52e091e5f312dd2299a82142755e1d7a1ec7ff1e --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSData+PGPUtils.h @@ -0,0 +1,35 @@ +// +// Copyright (c) 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 "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface NSData (PGPUtils) + +- (UInt16)pgp_Checksum; +- (UInt32)pgp_CRC24; +- (NSData *)pgp_MD5; +- (NSData *)pgp_SHA1; +- (NSData *)pgp_SHA224; +- (NSData *)pgp_SHA256; +- (NSData *)pgp_SHA384; +- (NSData *)pgp_SHA512; +- (NSData *)pgp_RIPEMD160; + +// xor up to the last byte of the shorter data ++ (NSData *)xor:(NSData *)d1 d2:(NSData *)d2; + ++ (NSData *)dataWithValue:(NSValue *)value; + +- (NSData *)pgp_HashedWithAlgorithm:(PGPHashAlgorithm)hashAlgorithm; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSData+compression.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSData+compression.h new file mode 100644 index 0000000000000000000000000000000000000000..603d080adcadbb9ff4844bbaff99b49884155c1e --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSData+compression.h @@ -0,0 +1,24 @@ +// +// NSData+zlib.h +// +// rfc1950 (zlib format) + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +extern NSString *const ZlibErrorDomain; + +@interface NSData (compression) + +- (nullable NSData *)zipCompressed:(NSError * __autoreleasing _Nullable *)error; +- (nullable NSData *)zlibCompressed:(NSError * __autoreleasing _Nullable *)error; +- (nullable NSData *)zipDecompressed:(NSError * __autoreleasing _Nullable *)error; +- (nullable NSData *)zlibDecompressed:(NSError * __autoreleasing _Nullable *)error; + +- (nullable NSData *)bzip2Decompressed:(NSError * __autoreleasing _Nullable *)error; +- (nullable NSData *)bzip2Compressed:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSMutableArray+PGPUtils.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSMutableArray+PGPUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..05d583efa7932261c590c81c258a8cf786d2ff5e --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSMutableArray+PGPUtils.h @@ -0,0 +1,19 @@ +// +// NSMutableArray+PGPUtils.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 10/09/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface NSMutableArray <ObjectType> (PGPUtils) + +- (void)pgp_addObject:(nullable ObjectType)anObject; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSMutableData+PGPUtils.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSMutableData+PGPUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..6c560c18bd86e6aac3f322969804a02ac30e77c9 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/NSMutableData+PGPUtils.h @@ -0,0 +1,21 @@ +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +@interface NSMutableData (PGPUtils) + +- (void)pgp_appendData:(nullable NSData *)other; + +- (void)XORWithData:(NSData *)data index:(NSUInteger)index; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/ObjectivePGP-Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/ObjectivePGP-Private.h new file mode 100644 index 0000000000000000000000000000000000000000..a40d6e9f3effe9b45cae097c84eac276077b4f06 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/ObjectivePGP-Private.h @@ -0,0 +1,72 @@ +// +// ObjectivePGP +// +// Copyright © Marcin Krzyżanowski. All rights reserved. +// +// DO NOT MODIFY. FILE GENERATED AUTOMATICALLY. + +#import <Foundation/Foundation.h> + +//! Project version number for ObjectivePGP. +FOUNDATION_EXPORT double ObjectivePGPVersionNumber; + +//! Project version string for ObjectivePGP. +FOUNDATION_EXPORT const unsigned char ObjectivePGPVersionString[]; + +#import <ObjectivePGP/PGPCryptoHash.h> +#import <ObjectivePGP/PGPMacros+Private.h> +#import <ObjectivePGP/PGPFoundation.h> +#import <ObjectivePGP/PGPSecretKeyPacket+Private.h> +#import <ObjectivePGP/PGPPacket+Private.h> +#import <ObjectivePGP/PGPCryptoUtils.h> +#import <ObjectivePGP/PGPRSA.h> +#import <ObjectivePGP/PGPS2K.h> +#import <ObjectivePGP/PGPElgamal.h> +#import <ObjectivePGP/NSArray+PGPUtils.h> +#import <ObjectivePGP/PGPUserIDPacket.h> +#import <ObjectivePGP/PGPSymetricKeyEncryptedSessionKeyPacket.h> +#import <ObjectivePGP/PGPSecretKeyPacket.h> +#import <ObjectivePGP/PGPPublicKeyPacket.h> +#import <ObjectivePGP/PGPPublicSubKeyPacket.h> +#import <ObjectivePGP/PGPUserAttributeImageSubpacket.h> +#import <ObjectivePGP/NSData+compression.h> +#import <ObjectivePGP/PGPSignatureSubpacket.h> +#import <ObjectivePGP/PGPSecretSubKeyPacket.h> +#import <ObjectivePGP/NSMutableData+PGPUtils.h> +#import <ObjectivePGP/PGPUserAttributePacket.h> +#import <ObjectivePGP/PGPPacket.h> +#import <ObjectivePGP/NSData+PGPUtils.h> +#import <ObjectivePGP/PGPUser+Private.h> +#import <ObjectivePGP/PGPBigNum.h> +#import <ObjectivePGP/PGPKeyMaterial.h> +#import <ObjectivePGP/PGPMPI.h> +#import <ObjectivePGP/PGPLiteralPacket.h> +#import <ObjectivePGP/PGPTrustPacket.h> +#import <ObjectivePGP/PGPSignatureSubpacketHeader.h> +#import <ObjectivePGP/PGPSignatureSubpacketCreationTime.h> +#import <ObjectivePGP/PGPUserAttributeSubpacket.h> +#import <ObjectivePGP/PGPSignaturePacket.h> +#import <ObjectivePGP/PGPOnePassSignaturePacket.h> +#import <ObjectivePGP/PGPPublicKeyEncryptedSessionKeyPacket.h> +#import <ObjectivePGP/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h> +#import <ObjectivePGP/PGPModificationDetectionCodePacket.h> +#import <ObjectivePGP/PGPEncryptedSessionKeyPacketProtocol.h> +#import <ObjectivePGP/PGPSymmetricallyEncryptedDataPacket.h> +#import <ObjectivePGP/PGPMarkerPacket.h> +#import <ObjectivePGP/PGPPKCSEmsa.h> +#import <ObjectivePGP/PGPPKCSEme.h> +#import <ObjectivePGP/PGPCryptoCFB.h> +#import <ObjectivePGP/PGPPacketHeader.h> +#import <ObjectivePGP/PGPLogging.h> +#import <ObjectivePGP/PGPCompressedPacket.h> +#import <ObjectivePGP/PGPPartialSubKey+Private.h> +#import <ObjectivePGP/PGPDSA.h> +#import <ObjectivePGP/PGPPublicKeyPacket+Private.h> +#import <ObjectivePGP/PGPSignatureSubpacket+Private.h> +#import <ObjectivePGP/PGPSignaturePacket+Private.h> +#import <ObjectivePGP/PGPKey+Private.h> +#import <ObjectivePGP/PGPPacketFactory.h> +#import <ObjectivePGP/PGPKeyring+Private.h> +#import <ObjectivePGP/PGPBigNum+Private.h> +#import <ObjectivePGP/PGPPartialKey+Private.h> +#import <ObjectivePGP/PGPSignatureSubpacketEmbeddedSignature.h> diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPBigNum+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPBigNum+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..16cc8c7f252e59e24da1450bab54613950df8102 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPBigNum+Private.h @@ -0,0 +1,26 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPBigNum.h> +#import <ObjectivePGP/PGPMacros.h> +#import <openssl/bn.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPBigNum () + +@property (nonatomic, readonly) BIGNUM *bignumRef; + +PGP_EMPTY_INIT_UNAVAILABLE; + +- (instancetype)initWithBIGNUM:(BIGNUM *)bignumRef; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPBigNum.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPBigNum.h new file mode 100644 index 0000000000000000000000000000000000000000..32a58a9a5ba77052040eab5293195ad335b5fbca --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPBigNum.h @@ -0,0 +1,21 @@ +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPBigNum : NSObject <NSCopying> + +@property (nonatomic, readonly) int bitsCount; +@property (nonatomic, readonly) int bytesCount; +@property (nonatomic, readonly) NSData *data; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCompressedPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCompressedPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..2c7c0beafe0ae7320640126d6e3cbf6da8225b64 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCompressedPacket.h @@ -0,0 +1,22 @@ +// +// Copyright (c) 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 "PGPPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPCompressedPacket : PGPPacket <NSCopying> + +@property (nonatomic, readonly) PGPCompressionAlgorithm compressionType; +@property (nonatomic, copy, readonly) NSData *decompressedData; + +- (instancetype)initWithData:(NSData *)data type:(PGPCompressionAlgorithm)type; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoCFB.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoCFB.h new file mode 100644 index 0000000000000000000000000000000000000000..33d3b7664516d574ffddc91e55d2458eec35b05b --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoCFB.h @@ -0,0 +1,31 @@ +// +// Copyright (c) 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 "PGPS2K.h" +#import "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPCryptoCFB : NSObject + ++ (nullable NSData *)decryptData:(NSData *)encryptedData + sessionKeyData:(NSData *)sessionKeyData // s2k produceSessionKeyWithPassphrase + symmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm + iv:(NSData *)ivData + syncCFB:(BOOL)openpgpCFB; + ++ (nullable NSData *)encryptData:(NSData *)encryptedData + sessionKeyData:(NSData *)sessionKeyData // s2k produceSessionKeyWithPassphrase + symmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm + iv:(NSData *)ivData + syncCFB:(BOOL)openpgpCFB; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoHash.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoHash.h new file mode 100644 index 0000000000000000000000000000000000000000..d51b836b095ef05ac1b74522b38dc6912267f834 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoHash.h @@ -0,0 +1,26 @@ +// +// Copyright (c) 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 "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^PGPUpdateBlock)(void (^update)(const void *data, int lenght)); + +NSData *_Nullable PGPCalculateHash(PGPHashAlgorithm algorithm, NS_NOESCAPE PGPUpdateBlock update); + +NSData *_Nullable PGPmd5(NS_NOESCAPE PGPUpdateBlock update); +NSData *_Nullable PGPsha1(NS_NOESCAPE PGPUpdateBlock update); +NSData *_Nullable PGPsha224(NS_NOESCAPE PGPUpdateBlock update); +NSData *_Nullable PGPsha256(NS_NOESCAPE PGPUpdateBlock update); +NSData *_Nullable PGPsha384(NS_NOESCAPE PGPUpdateBlock update); +NSData *_Nullable PGPsha512(NS_NOESCAPE PGPUpdateBlock update); +NSData *_Nullable PGPripemd160(NS_NOESCAPE PGPUpdateBlock update); + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoUtils.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoUtils.h new file mode 100644 index 0000000000000000000000000000000000000000..da7c5e5f7f04183a6b72d78e5248ca23b6c04f99 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPCryptoUtils.h @@ -0,0 +1,25 @@ +// +// Copyright (c) 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 "PGPTypes.h" +#import "PGPSecretKeyPacket.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPCryptoUtils : NSObject + ++ (NSUInteger)blockSizeOfSymmetricAlhorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm; ++ (NSUInteger)keySizeOfSymmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm; ++ (NSUInteger)hashSizeOfHashAlhorithm:(PGPHashAlgorithm)hashAlgorithm; ++ (NSData *)randomData:(NSUInteger)length; ++ (nullable NSData *)decrypt:(NSData *)data usingSecretKeyPacket:(PGPSecretKeyPacket *)keyPacket encryptedMPIs:(NSArray <PGPMPI *> *)encryptedMPIs; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPDSA.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPDSA.h new file mode 100644 index 0000000000000000000000000000000000000000..6b111debe5945381eeb5cdd62fa8c4b3253111ca --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPDSA.h @@ -0,0 +1,31 @@ +// +// Copyright (c) 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 "PGPMPI.h" +#import "PGPTypes.h" +#import "PGPKeyMaterial.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSecretKeyPacket, PGPPublicKeyPacket, PGPSignaturePacket, PGPKey; + +@interface PGPDSA : NSObject + +PGP_EMPTY_INIT_UNAVAILABLE; + +// signature ++ (BOOL)verify:(NSData *)toVerify signature:(PGPSignaturePacket *)signaturePacket withPublicKeyPacket:(PGPPublicKeyPacket *)publicKeyPacket; ++ (NSArray<PGPMPI *> *)sign:(NSData *)toSign key:(PGPKey *)key; + +// new keys ++ (nullable PGPKeyMaterial *)generateNewKeyMPIArray:(const int)bits; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPElgamal.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPElgamal.h new file mode 100644 index 0000000000000000000000000000000000000000..c03acaef7b6792a6ee330ac60101ebf193635759 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPElgamal.h @@ -0,0 +1,32 @@ +// +// +// Copyright (C) Marcin Krzyżanowski <marcin@krzyzanowskim.com> +// This software is provided 'as-is', without any express or implied warranty. +// +// 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 "PGPMPI.h" +#import "PGPTypes.h" +#import "PGPKeyMaterial.h" +#import "PGPPublicKeyPacket.h" +#import "PGPSecretKeyPacket.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPElgamal : NSObject + +PGP_EMPTY_INIT_UNAVAILABLE; + +// encryption ++ (nullable NSArray<PGPBigNum *> *)publicEncrypt:(NSData *)toEncrypt withPublicKeyPacket:(PGPPublicKeyPacket *)publicKeyPacket; ++ (nullable NSData *)privateDecrypt:(NSData *)toDecrypt withSecretKeyPacket:(PGPSecretKeyPacket *)secretKeyPacket gk:(PGPMPI *)gkMPI; + + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPEncryptedSessionKeyPacketProtocol.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPEncryptedSessionKeyPacketProtocol.h new file mode 100644 index 0000000000000000000000000000000000000000..534a66f7e8ea2918e8068d8a6630482b15077b6d --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPEncryptedSessionKeyPacketProtocol.h @@ -0,0 +1,18 @@ +//// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSecretKeyPacket; + +@protocol PGPEncryptedSessionKeyPacketProtocol <NSObject> + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPFoundation.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPFoundation.h new file mode 100644 index 0000000000000000000000000000000000000000..a4a304649e10828dfc0cdc7b9d937f6ef6ee4baa --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPFoundation.h @@ -0,0 +1,24 @@ + +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +#define PGPCast(obj, c) ((c * _Nullable) _pgp__cast(obj, c.class)) + +id _Nullable _pgp__cast(id _Nullable obj, Class objClass); + +BOOL PGPEqualObjects(id _Nullable obj1, id _Nullable obj2); + +@interface PGPFoundation : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKey+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKey+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..9f347f5d2ed179c2b19c2e8be147008bf47adbcd --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKey+Private.h @@ -0,0 +1,21 @@ +// +// Copyright (c) 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" +#import "PGPPartialKey.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPKey () + +@property (nonatomic, nullable, copy, readwrite) PGPPartialKey *secretKey; +@property (nonatomic, nullable, copy, readwrite) PGPPartialKey *publicKey; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKeyMaterial.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKeyMaterial.h new file mode 100644 index 0000000000000000000000000000000000000000..e58774c10cc3bfb771241c39bec86bc385e7f32e --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKeyMaterial.h @@ -0,0 +1,25 @@ +// +// Copyright (c) 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> +#import "PGPMPI.h" + +@interface PGPKeyMaterial: NSObject + +@property (nonatomic, copy) PGPMPI *n; +@property (nonatomic, copy) PGPMPI *e; +@property (nonatomic, copy) PGPMPI *d; +@property (nonatomic, copy) PGPMPI *p; +@property (nonatomic, copy) PGPMPI *q; +@property (nonatomic, copy) PGPMPI *r; +@property (nonatomic, copy) PGPMPI *g; +@property (nonatomic, copy) PGPMPI *u; +@property (nonatomic, copy) PGPMPI *x; +@property (nonatomic, copy) PGPMPI *y; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKeyring+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKeyring+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..f724441f2c612ff9b856ccdcd44706cec0a99b51 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPKeyring+Private.h @@ -0,0 +1,24 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPKeyring.h> +#import <ObjectivePGP/PGPKey.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPKeyring () + +// Private ++ (nullable PGPKey *)findKeyWithKeyID:(PGPKeyID *)searchKeyID in:(NSArray<PGPKey *> *)keys; ++ (NSArray<PGPKey *> *)addOrUpdatePartialKey:(nullable PGPPartialKey *)key inContainer:(NSArray<PGPKey *> *)keys; + +@end + +NS_ASSUME_NONNULL_END + diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPLiteralPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPLiteralPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..22b5c2c3c4fb47f3ed3a9f25be4c55f7d927f1e8 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPLiteralPacket.h @@ -0,0 +1,33 @@ +// +// Copyright (c) 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 "PGPExportableProtocol.h" +#import "PGPPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(UInt8, PGPLiteralPacketFormat) { + PGPLiteralPacketBinary = 'b', + PGPLiteralPacketText = 't', + PGPLiteralPacketTextUTF8 = 'u' +}; + +@interface PGPLiteralPacket : PGPPacket <PGPExportable, NSCopying> + +@property (nonatomic) PGPLiteralPacketFormat format; +@property (nonatomic, copy) NSDate *timestamp; +@property (nonatomic, copy, nullable) NSString *filename; + +@property (nonatomic, copy) NSData *literalRawData; + +- (instancetype)initWithData:(NSData *)rawData; ++ (PGPLiteralPacket *)literalPacket:(PGPLiteralPacketFormat)format withData:(NSData *)rawData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPLogging.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPLogging.h new file mode 100644 index 0000000000000000000000000000000000000000..5b14e1797cefbb642657ee10a04ab9b8ada56763 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPLogging.h @@ -0,0 +1,55 @@ +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +#define PGP_NO_LOG 0x00 +#define PGP_ERROR_LEVEL 0x01 +#define PGP_WARNING_LEVEL 0x02 +#define PGP_DEBUG_LEVEL 0x03 + +#ifndef PGP_LOG_LEVEL + #ifdef DEBUG + #define PGP_LOG_LEVEL PGP_DEBUG_LEVEL + #else + #define PGP_LOG_LEVEL PGP_WARNING_LEVEL + #endif +#endif + +#define _PGPLogMacro(_level, _tag, _message) NSLog(@"[%s] %s: %s/%tu %@", _tag, _level, __PRETTY_FUNCTION__, __LINE__, _message()) + +#if PGP_LOG_LEVEL >= PGP_DEBUG_LEVEL +#define PGPLogDebug(format, ...) \ + _PGPLogMacro("DEBUG", "ObjectivePGP", (^{ \ + return [NSString stringWithFormat:(@"" format), ##__VA_ARGS__]; \ + })) +#else +#define PGPLogDebug(format, ...) +#endif + +#if PGP_LOG_LEVEL >= PGP_WARNING_LEVEL +#define PGPLogWarning(format, ...) \ + _PGPLogMacro("WARNING", "ObjectivePGP", (^{ \ + return [NSString stringWithFormat:(@"" format), ##__VA_ARGS__]; \ + })) +#else +#define PGPLogWarning(format, ...) +#endif + +#if PGP_LOG_LEVEL >= PGP_ERROR_LEVEL +#define PGPLogError(format, ...) \ + _PGPLogMacro("ERROR", "ObjectivePGP", (^{ \ + return [NSString stringWithFormat:(@"" format), ##__VA_ARGS__]; \ + })) +#else +#define PGPLogError(format, ...) +#endif + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMPI.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMPI.h new file mode 100644 index 0000000000000000000000000000000000000000..b99757e8bf252a74ba99679da74f9172a007f700 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMPI.h @@ -0,0 +1,47 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPBigNum.h> +#import <ObjectivePGP/PGPMacros.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +OBJC_EXTERN NSString * const PGPMPI_N; +OBJC_EXTERN NSString * const PGPMPI_E; +OBJC_EXTERN NSString * const PGPMPI_P; +OBJC_EXTERN NSString * const PGPMPI_G; +OBJC_EXTERN NSString * const PGPMPI_Q; +OBJC_EXTERN NSString * const PGPMPI_D; +OBJC_EXTERN NSString * const PGPMPI_U; +OBJC_EXTERN NSString * const PGPMPI_X; +OBJC_EXTERN NSString * const PGPMPI_R; +OBJC_EXTERN NSString * const PGPMPI_S; +OBJC_EXTERN NSString * const PGPMPI_Y; +OBJC_EXTERN NSString * const PGPMPI_M; + +@interface PGPMPI : NSObject <NSCopying> + +@property (nonatomic, copy, readonly) NSString *identifier; +@property (nonatomic, readonly) PGPBigNum *bigNum; +/** + * Total bytes, header + body + */ +@property (nonatomic, readonly) NSUInteger packetLength; + +PGP_EMPTY_INIT_UNAVAILABLE; + +- (instancetype)initWithData:(NSData *)dataToMPI identifier:(NSString *)identifier NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithBigNum:(PGPBigNum *)bigNum identifier:(NSString *)identifier; +- (instancetype)initWithMPIData:(NSData *)mpiData identifier:(NSString *)identifier atPosition:(NSUInteger)position; +- (nullable NSData *)exportMPI; +- (nullable NSData *)bodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMacros+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMacros+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..75a42d1119bc32f5b55e2142d1c1e3ab13fd84a1 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMacros+Private.h @@ -0,0 +1,51 @@ +// +// Copyright (c) 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 "PGPMacros.h" + +#define let const __auto_type +#define var __auto_type + +#define pgpweakify(var) __weak typeof(var) PGPWeak_##var = var; + +#define pgpstrongify(var) \ + _Pragma("clang diagnostic push") \ + _Pragma("clang diagnostic ignored \"-Wshadow\"") \ + __strong typeof(var) var = PGPWeak_##var; \ + _Pragma("clang diagnostic pop") + +#define PGP_CLASS_EXPORT __attribute__((visibility("default"))) + +#define PGP_EMPTY_INIT_UNAVAILABLE \ + -(instancetype)init __attribute__((unavailable("Not the designated initializer"))); \ + +(instancetype)new __attribute__((unavailable("Not the designated initializer"))); + +#define PGPAssertClass(object, allowedClass) \ + do { \ + NSAssert([object isKindOfClass:[allowedClass class]], @"Object type not satisfying: '%@' must be of type '%s' but is '%@'.", object, #allowedClass, (object ? NSStringFromClass((Class)[object class]) : @"(null)")); \ + } while (0); + +#define PGPNN(thing) \ + ^{ \ + __auto_type _Nonnull thang = thing; \ + NSCAssert(thang != nil, @"'" #thing "' Object must exist"); \ + return thang; \ + }() + +// Similar to defer in Swift +#define pgp_defer_block_name_with_prefix(prefix, suffix) prefix##suffix +#define pgp_defer_block_name(suffix) pgp_defer_block_name_with_prefix(pgp_defer_, suffix) +#define pgp_defer __strong void (^pgp_defer_block_name(__LINE__))(void) __attribute__((cleanup(pgp_defer_cleanup_block), unused)) = ^ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" +static void pgp_defer_cleanup_block(__strong void (^ _Nonnull * _Nonnull block)(void)) { (*block)(); } +#pragma clang diagnostic pop + +#define PGPDataAppendPropertyBytes(d,var,len) \ + [d appendBytes:&self->_##var length:len] + diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMarkerPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMarkerPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..5efb89b146a7711b06fde8527e08798634c7dbd5 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPMarkerPacket.h @@ -0,0 +1,21 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPPacket.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPMarkerPacket : PGPPacket + +PGP_EMPTY_INIT_UNAVAILABLE + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPModificationDetectionCodePacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPModificationDetectionCodePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..3224e84ea963972bb9e8966f1b42c7f55ec4d418 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPModificationDetectionCodePacket.h @@ -0,0 +1,21 @@ +// +// Copyright (c) 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 "PGPPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPModificationDetectionCodePacket : PGPPacket <NSCopying, PGPExportable> + +@property (nonatomic, copy, readonly) NSData *hashData; + +- (instancetype)initWithData:(NSData *)data; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPOnePassSignaturePacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPOnePassSignaturePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..1dec32f71328c1da5ea0225ef5e9c447c336a277 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPOnePassSignaturePacket.h @@ -0,0 +1,27 @@ +// +// Copyright (c) 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 "PGPPacket.h" +#import "PGPExportableProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPKeyID; + +@interface PGPOnePassSignaturePacket : PGPPacket <PGPExportable, NSCopying> + +@property (nonatomic) UInt8 version; // The current version is 3. +@property (nonatomic) PGPSignatureType signatureType; +@property (nonatomic) PGPHashAlgorithm hashAlgorithm; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, copy) PGPKeyID *keyID; // 8 +@property (nonatomic) BOOL isNested; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPKCSEme.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPKCSEme.h new file mode 100644 index 0000000000000000000000000000000000000000..0c6cd70681e2cdb2c447df767cf58cc1b36eba17 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPKCSEme.h @@ -0,0 +1,16 @@ +// +// Copyright (c) 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> + +@interface PGPPKCSEme : NSObject + ++ (NSData *)encodeMessage:(NSData *)m keyModulusLength:(NSUInteger)k error:(NSError * __autoreleasing *)error; ++ (NSData *)decodeMessage:(NSData *)m error:(NSError * __autoreleasing *)error; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPKCSEmsa.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPKCSEmsa.h new file mode 100644 index 0000000000000000000000000000000000000000..970ed303790227bb048294b00346d33e418a85e8 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPKCSEmsa.h @@ -0,0 +1,16 @@ +// +// Copyright (c) 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 "PGPTypes.h" +#import <Foundation/Foundation.h> + +@interface PGPPKCSEmsa : NSObject + ++ (NSData *)encode:(PGPHashAlgorithm)hashAlgorithm message:(NSData *)m encodedMessageLength:(NSUInteger)emLen error:(NSError * __autoreleasing *)error; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacket+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacket+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..828e33b4431fddbf3058b086ad8b00d0ac4df154 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacket+Private.h @@ -0,0 +1,20 @@ +// +// Copyright (c) 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 "PGPPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPacket () + +@property (nonatomic) BOOL indeterminateLength; // should not be used, but gpg uses it +@property (nonatomic, readwrite) PGPPacketTag tag; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..614585bb21df78cf57009356dbc4da37711c3932 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacket.h @@ -0,0 +1,33 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPExportableProtocol.h> +#import <ObjectivePGP/PGPTypes.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +extern const UInt32 PGPUnknownLength; + +@interface PGPPacket : NSObject <NSCopying, PGPExportable> + +@property (nonatomic, readonly) PGPPacketTag tag; + +- (instancetype)init NS_DESIGNATED_INITIALIZER; ++ (nullable instancetype)packetWithBody:(NSData *)bodyData; + ++ (nullable NSData *)readPacketBody:(NSData *)data headerLength:(UInt32 *)headerLength consumedBytes:(nullable NSUInteger *)consumedBytes packetTag:(nullable PGPPacketTag *)tag indeterminateLength:(nullable BOOL *)indeterminateLength; +- (NSUInteger)parsePacketBody:(NSData *)packetBody error:(NSError * __autoreleasing _Nullable *)error; + ++ (NSData *)buildPacketOfType:(PGPPacketTag)tag withBody:(NS_NOESCAPE NSData *(^)(void))body; + +- (id)copyWithZone:(nullable NSZone *)zone NS_REQUIRES_SUPER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacketFactory.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacketFactory.h new file mode 100644 index 0000000000000000000000000000000000000000..dc02d7bf7557b1ebf0cf400979b08dea86f65921 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacketFactory.h @@ -0,0 +1,20 @@ +// +// Copyright (c) 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 "PGPPacket.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPacketFactory : NSObject + ++ (nullable PGPPacket *)packetWithData:(NSData *)packetsData offset:(NSUInteger)offset consumedBytes:(nullable NSUInteger *)consumedBytes; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacketHeader.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacketHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..6f91dbf1f7eaefcb9a10f62d6a568dd94e840fc1 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPacketHeader.h @@ -0,0 +1,34 @@ +// Copyright (c) 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> +#import <ObjectivePGP/PGPTypes.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPacketHeader : NSObject + +@property (nonatomic) UInt32 headerLength; +@property (nonatomic) NSUInteger bodyLength; +@property (nonatomic) PGPPacketTag packetTag; + +// New format only +@property (nonatomic, getter=isPartialLength) BOOL partialLength; + +// Old format only +@property (nonatomic, getter=isIndeterminateLength) BOOL indeterminateLength; + ++ (nullable PGPPacketHeader *)newFormatHeaderFromData:(NSData *)data; ++ (nullable PGPPacketHeader *)oldFormatHeaderFromData:(NSData *)data; ++ (NSData *)buildNewFormatLengthDataForData:(NSData *)bodyData; ++ (NSData *)buildOldFormatLengthDataForData:(NSData *)bodyData; + ++ (void)getLengthFromNewFormatOctets:(NSData *)lengthOctetsData bodyLength:(NSUInteger *)bodyLength bytesCount:(UInt8 *)bytesCount isPartial:(nullable BOOL *)isPartial; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPartialKey+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPartialKey+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..5474dda2d64ca97665c28262e4236b692aaff859 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPartialKey+Private.h @@ -0,0 +1,24 @@ +// +// Copyright (c) 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 "PGPPartialKey.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPartialKey () + +@property (nonatomic, readwrite) PGPKeyType type; +@property (nonatomic, copy, readwrite) NSArray<PGPPartialSubKey *> *subKeys; +@property (nonatomic, copy, readwrite) NSArray<PGPSignaturePacket *> *directSignatures; +@property (nonatomic, nullable, copy, readwrite) PGPSignaturePacket *revocationSignature; + +- (void)loadPackets:(NSArray<PGPPacket *> *)packets NS_REQUIRES_SUPER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPartialSubKey+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPartialSubKey+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..b1d2ded345b7f3f3b3f91122de6c05318cb62506 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPartialSubKey+Private.h @@ -0,0 +1,15 @@ +// +// Copyright (c) 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 "PGPPartialSubKey.h" + +@interface PGPPartialSubKey () + +@property (nonatomic, nullable, copy) PGPSignaturePacket *bindingSignature; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyEncryptedSessionKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyEncryptedSessionKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..8e5c14d21263a364d6f2f1d47b4ffd5436762329 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyEncryptedSessionKeyPacket.h @@ -0,0 +1,28 @@ +// +// Copyright (c) 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 "PGPPacket.h" +#import "PGPExportableProtocol.h" +#import "PGPEncryptedSessionKeyPacketProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPKeyID, PGPPublicKeyPacket, PGPSecretKeyPacket; + +@interface PGPPublicKeyEncryptedSessionKeyPacket : PGPPacket <PGPEncryptedSessionKeyPacketProtocol, NSCopying, PGPExportable> +@property (nonatomic) UInt8 version; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, copy) PGPKeyID *keyID; + +- (BOOL)encrypt:(PGPPublicKeyPacket *)publicKeyPacket sessionKeyData:(NSData *)sessionKeyData sessionKeyAlgorithm:(PGPSymmetricAlgorithm)sessionKeyAlgorithm error:(NSError * __autoreleasing _Nullable *)error; + +- (nullable NSData *)decryptSessionKeyData:(PGPSecretKeyPacket *)secretKeyPacket sessionKeyAlgorithm:(PGPSymmetricAlgorithm *)sessionKeyAlgorithm error:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..abbcc0068eef1195803e42886af74f4d995860da --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket+Private.h @@ -0,0 +1,24 @@ +// +// Copyright (c) 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 "PGPPublicKeyPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPublicKeyPacket () + +@property (nonatomic, readwrite) UInt8 version; +@property (nonatomic, readwrite) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, copy, readwrite) NSDate *createDate; +@property (nonatomic, readwrite) UInt16 V3validityPeriod; + +@property (nonatomic, copy) NSArray<PGPMPI *> *publicMPIs; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..15d602b9f30b6829880cf8cca16d76e65921010e --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket.h @@ -0,0 +1,40 @@ +// +// Copyright (c) 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. +// +// Tag 6 + +#import "PGPPacketFactory.h" +#import "PGPFingerprint.h" +#import "PGPKeyID.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPMPI, PGPBigNum; + +@interface PGPPublicKeyPacket : PGPPacket <NSCopying, PGPExportable> + +@property (nonatomic, readonly) UInt8 version; +@property (nonatomic, readonly) NSDate *createDate; +@property (nonatomic, readonly) UInt16 V3validityPeriod; // obsolete +@property (nonatomic, readonly) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, readonly) BOOL isSupported; + +// generated properties +@property (nonatomic, readonly) NSUInteger keySize; +@property (nonatomic, readonly) PGPFingerprint *fingerprint; +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (NSData *)exportKeyPacketOldStyle; +- (NSData *)buildKeyBodyData:(BOOL)forceV4; + +- (nullable PGPMPI *)publicMPI:(NSString *)identifier; +- (nullable NSArray<PGPMPI *> *)encryptData:(NSData *)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicSubKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicSubKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..d53a151c291e768e1f97b1ffe87d59cd04615774 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPPublicSubKeyPacket.h @@ -0,0 +1,16 @@ +// +// Copyright (c) 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. +// +// Tag 14 + +#import "PGPPacketFactory.h" +#import "PGPPublicKeyPacket.h" +#import <Foundation/Foundation.h> + +@interface PGPPublicSubKeyPacket : PGPPublicKeyPacket + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPRSA.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPRSA.h new file mode 100644 index 0000000000000000000000000000000000000000..5677d00c27e19ba803138b57de5f9eeb9502075b --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPRSA.h @@ -0,0 +1,35 @@ +// +// Copyright (c) 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 "PGPMPI.h" +#import "PGPTypes.h" +#import "PGPKeyMaterial.h" +#import "PGPPublicKeyPacket.h" +#import "PGPSecretKeyPacket.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPRSA : NSObject + +PGP_EMPTY_INIT_UNAVAILABLE; + +// encryption ++ (nullable NSData *)publicEncrypt:(NSData *)toEncrypt withPublicKeyPacket:(PGPPublicKeyPacket *)publicKeyPacket; ++ (nullable NSData *)privateDecrypt:(NSData *)toDecrypt withSecretKeyPacket:(PGPSecretKeyPacket *)secretKeyPacket; + +// signature ++ (nullable NSData *)publicDecrypt:(NSData *)toDecrypt withPublicKeyPacket:(PGPPublicKeyPacket *)publicKeyPacket; ++ (nullable NSData *)privateEncrypt:(NSData *)toEncrypt withSecretKeyPacket:(PGPSecretKeyPacket *)secretKeyPacket; + +// new keys ++ (nullable PGPKeyMaterial *)generateNewKeyMPIArray:(const int)bits; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPS2K.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPS2K.h new file mode 100644 index 0000000000000000000000000000000000000000..7f3c2f0d24335dae7170f71593d028f764742e83 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPS2K.h @@ -0,0 +1,37 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPExportableProtocol.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPS2K : NSObject <NSCopying, PGPExportable> + +@property (nonatomic, readonly) PGPS2KSpecifier specifier; +@property (nonatomic, readonly) PGPHashAlgorithm hashAlgorithm; +// random 8 bytes. +@property (nonatomic, copy, readonly) NSData *salt; +// Iteration count. +@property (nonatomic) UInt32 iterationsCount; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithSpecifier:(PGPS2KSpecifier)specifier hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm NS_DESIGNATED_INITIALIZER; + ++ (PGPS2K *)S2KFromData:(NSData *)data atPosition:(NSUInteger)position length:(nullable NSUInteger *)length; + +- (nullable NSData *)buildKeyDataForPassphrase:(NSData *)passphrase prefix:(nullable NSData *)prefix salt:(NSData *)salt codedCount:(UInt32)codedCount; +- (nullable NSData *)produceSessionKeyWithPassphrase:(NSString *)passphrase symmetricAlgorithm:(PGPSymmetricAlgorithm)symmetricAlgorithm; +- (nullable NSData *)export:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..f27a442816909ae10474e6b3edb71697c8a213ff --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket+Private.h @@ -0,0 +1,26 @@ +// +// Copyright (c) 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 "PGPPublicKeyPacket+Private.h" +#import "PGPS2K.h" +#import "PGPSecretKeyPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSecretKeyPacket () + +@property (nonatomic, readwrite) PGPS2KUsage s2kUsage; +@property (nonatomic, copy, readwrite) PGPS2K *s2k; +@property (nonatomic, readwrite) PGPSymmetricAlgorithm symmetricAlgorithm; +@property (nonatomic, copy, nullable, readwrite) NSData *ivData; +@property (nonatomic, copy) NSArray<PGPMPI *> *secretMPIs; // decrypted MPI +@property (nonatomic, nullable, copy) NSData *encryptedMPIPartData; // after decrypt -> secretMPIs + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..5a72a38473b91072cada97641a400d45ae88b30a --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket.h @@ -0,0 +1,37 @@ +// +// Copyright (c) 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 "PGPPublicKeyPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPS2K; + +@interface PGPSecretKeyPacket : PGPPublicKeyPacket <NSCopying, PGPExportable> + +@property (nonatomic, readonly) PGPS2KUsage s2kUsage; +@property (nonatomic, copy, readonly) PGPS2K *s2k; +@property (nonatomic, readonly) PGPSymmetricAlgorithm symmetricAlgorithm; +@property (nonatomic, nullable, copy, readonly) NSData *ivData; +@property (nonatomic, getter=isEncryptedWithPassphrase, readonly) BOOL encryptedWithPassphrase; + +/** + * Decrypt packet + * + * @param passphrase Passphrase + * @param error error + * + * @return Decrypted key on success + */ +- (nullable PGPSecretKeyPacket *)decryptedWithPassphrase:(nullable NSString *)passphrase error:(NSError * __autoreleasing _Nullable *)error; + +- (nullable PGPMPI *)secretMPI:(NSString *)identifier; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretSubKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretSubKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..2d7db4c0a9d7c2cdfd52b70a05d008729d7a2e86 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSecretSubKeyPacket.h @@ -0,0 +1,13 @@ +// +// Copyright (c) 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 "PGPSecretKeyPacket.h" + +@interface PGPSecretSubKeyPacket : PGPSecretKeyPacket + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..dee6c23cbce97ae9d46b4a88c25e1ff282589645 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket+Private.h @@ -0,0 +1,30 @@ +// +// Copyright (c) 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 "PGPSignaturePacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSignaturePacket () + +@property (nonatomic, copy, readwrite) NSArray<PGPSignatureSubpacket *> *hashedSubpackets; +@property (nonatomic, copy, readwrite) NSArray<PGPSignatureSubpacket *> *unhashedSubpackets; +@property (nonatomic, readwrite) PGPSignatureType type; + +PGP_EMPTY_INIT_UNAVAILABLE + ++ (PGPSignaturePacket *)signaturePacket:(PGPSignatureType)type hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm; + +- (nullable NSData *)buildDataToSignForType:(PGPSignatureType)type inputData:(nullable NSData *)inputData key:(nullable PGPKey *)key subKey:(nullable PGPKey *)subKey userID:(nullable NSString *)userID error:(NSError * __autoreleasing _Nullable *)error; +- (nullable NSData *)buildFullSignatureBodyData; +- (nullable PGPMPI *)signatureMPI:(NSString *)identifier; + +@end + + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..793e84b0e3ef7f9eeadaf6306e396542caf8b0c1 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket.h @@ -0,0 +1,76 @@ +// +// Copyright (c) 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. +// +// Tag 2 + +#import "PGPKeyID.h" +#import "PGPMPI.h" +#import "PGPPacketFactory.h" +#import "PGPSignatureSubpacket.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPPartialKey, PGPUser, PGPUserIDPacket, PGPPublicKeyPacket, PGPKey; + +@interface PGPSignaturePacket : PGPPacket <NSCopying> + +@property (nonatomic) UInt8 version; +@property (nonatomic, readonly) PGPSignatureType type; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic) PGPHashAlgorithm hashAlgoritm; +@property (nonatomic, copy, readonly) NSArray<PGPSignatureSubpacket *> *hashedSubpackets; +@property (nonatomic, copy, readonly) NSArray<PGPSignatureSubpacket *> *unhashedSubpackets; +/// Two-octet field holding the left 16 bits of the signed hash value. +/// Read from the key or set byt the call to `-[PGPSignaturePacket signData:usingKey:passphrase:userID:error]` +@property (nonatomic, copy, nullable) NSData *signedHashValueData; +@property (nonatomic, copy) NSArray<PGPMPI *> *signatureMPIs; + +@property (nonatomic, readonly) BOOL canBeUsedToSign; // computed +@property (nonatomic, readonly) BOOL canBeUsedToEncrypt; // computed + +@property (nonatomic, nullable, readonly) PGPKeyID *issuerKeyID; // computed +@property (nonatomic, copy, readonly) NSArray<PGPSignatureSubpacket *> *subpackets; // computed +@property (nonatomic, nullable, readonly) NSDate *expirationDate; // computed +@property (nonatomic, readonly, readonly, getter=isExpired) BOOL expired; // computed +@property (nonatomic, nullable, readonly) NSDate *creationDate; // computed +@property (nonatomic, readonly, readonly, getter=isPrimaryUserID) BOOL primaryUserID; // computed + +/** + * Create signature packet for signing. This is convienience constructor. + * + * @param type example: PGPSignatureBinaryDocument + * @param hashAlgorithm hash algorithm to be used for signature + * + * @return Packet instance ready to call signData:secretKey + */ ++ (PGPSignaturePacket *)signaturePacket:(PGPSignatureType)type hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm; + +- (NSArray<PGPSignatureSubpacket *> *)subpacketsOfType:(PGPSignatureSubpacketType)type; +- (NSData *)calculateSignedHashForDataToSign:(NSData *)dataToSign; + +/** + * Build signature data (signature packet with subpackets). + * + * @param inputData Data to sign. + * @param key A key used to create signature. + * @param subKey Optional. if signature subkey can't be found automatically. + * @param passphrase Optional. Key passphrase do decrypt. + * @param userID Optional. + * @param error error + * + * @return YES on success. + */ +- (BOOL)signData:(nullable NSData *)inputData withKey:(PGPKey *)key subKey:(nullable PGPKey *)subKey passphrase:(nullable NSString *)passphrase userID:(nullable NSString *)userID error:(NSError * __autoreleasing *)error; + +- (BOOL)verifyData:(NSData *)inputData publicKey:(PGPKey *)publicKey error:(NSError * __autoreleasing _Nullable *)error; +- (BOOL)verifyData:(NSData *)inputData publicKey:(PGPKey *)publicKey userID:(nullable NSString *)userID error:(NSError * __autoreleasing _Nullable *)error; +- (BOOL)verifyData:(NSData *)inputData publicKey:(PGPKey *)publicKey signingKeyPacket:(PGPPublicKeyPacket *)signingKeyPacket userID:(nullable NSString *)userID error:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacket+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacket+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..1e155eae8470ebb3a017f8eab251a1376e0ae313 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacket+Private.h @@ -0,0 +1,15 @@ +// +// Copyright (c) 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> + +@interface PGPSignatureSubpacket () + +@property (nonatomic, readwrite, nullable, copy) id<NSObject, NSCopying> value; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacket.h new file mode 100644 index 0000000000000000000000000000000000000000..8f6149ca826dc315b0d9f3bc68cccf7197bf8310 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacket.h @@ -0,0 +1,38 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPExportableProtocol.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSignatureSubpacketHeader; + +@interface PGPSignatureSubpacket : NSObject <NSCopying, PGPExportable> + +@property (nonatomic, readonly) PGPSignatureSubpacketType type; +@property (nonatomic, readonly, nullable, copy) id<NSObject, NSCopying> value; +@property (nonatomic, readonly) NSUInteger length; +/// If set, it denotes that the subpacket is one that is critical for the evaluator of the signature to recognize. +@property (nonatomic, readonly, getter=isCritical) BOOL critical; + +PGP_EMPTY_INIT_UNAVAILABLE; + +- (instancetype)initWithType:(PGPSignatureSubpacketType)type andValue:(nullable id<NSObject, NSCopying>)value NS_DESIGNATED_INITIALIZER; +- (nullable instancetype)initWithHeader:(PGPSignatureSubpacketHeader *)header body:(NSData *)subPacketBodyData; + ++ (PGPSignatureSubpacketHeader *)subpacketHeaderFromData:(NSData *)headerData; + +- (void)parseSubpacketBody:(NSData *)packetBody; +- (nullable NSData *)export:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketCreationTime.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketCreationTime.h new file mode 100644 index 0000000000000000000000000000000000000000..1dea1529aed3e510903b2176e5f33bb81c7821a2 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketCreationTime.h @@ -0,0 +1,30 @@ +// +// Copyright (c) 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. +// +// 5.2.3.4. Signature Creation Time +// Signature Creation Time MUST be present in the hashed area. + +#import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPExportableProtocol.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSignatureSubpacketCreationTime : NSObject <NSCopying> + +@property (nonatomic, copy, readonly) NSDate *value; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithDate:(NSDate *)date NS_DESIGNATED_INITIALIZER; + ++ (instancetype)packetWithData:(NSData *)packetBodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketEmbeddedSignature.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketEmbeddedSignature.h new file mode 100644 index 0000000000000000000000000000000000000000..6bb44de581acecc8c2fe803b42544a3933d7d436 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketEmbeddedSignature.h @@ -0,0 +1,29 @@ +// Copyright (c) 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. +// +// 5.2.3.26. Embedded Signature + +#import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPExportableProtocol.h> +#import <ObjectivePGP/PGPSignatureSubpacket.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSignaturePacket; + +@interface PGPSignatureSubpacketEmbeddedSignature : NSObject <NSCopying, PGPExportable> + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithSignature:(PGPSignaturePacket *)signature NS_DESIGNATED_INITIALIZER; + ++ (instancetype)packetWithData:(NSData *)packetBodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketHeader.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketHeader.h new file mode 100644 index 0000000000000000000000000000000000000000..70b51acfbb536dbf0a1510dd2e796533ca38b936 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSignatureSubpacketHeader.h @@ -0,0 +1,22 @@ +// +// Copyright (c) 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 "PGPTypes.h" +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSignatureSubpacketHeader : NSObject + +@property (nonatomic) PGPSignatureSubpacketType type; +@property (nonatomic) NSUInteger headerLength; +@property (nonatomic) NSUInteger bodyLength; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymetricKeyEncryptedSessionKeyPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymetricKeyEncryptedSessionKeyPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..be31acd3269c9cdbebdf01492d85dc93a3facdbf --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymetricKeyEncryptedSessionKeyPacket.h @@ -0,0 +1,26 @@ +// +// Copyright (c) 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 "PGPPacket.h" +#import "PGPExportableProtocol.h" +#import "PGPEncryptedSessionKeyPacketProtocol.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPS2K; + +@interface PGPSymetricKeyEncryptedSessionKeyPacket : PGPPacket <PGPEncryptedSessionKeyPacketProtocol, NSCopying, PGPExportable> +@property (nonatomic) UInt8 version; +@property (nonatomic) PGPSymmetricAlgorithm symmetricAlgorithm; +@property (nonatomic, copy) PGPS2K *s2k; +@property (nonatomic, copy, nullable) NSData *encryptedSessionKey; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymmetricallyEncryptedDataPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymmetricallyEncryptedDataPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..9fedbe1533f1da0892d48a777091fffaeb4d1368 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymmetricallyEncryptedDataPacket.h @@ -0,0 +1,23 @@ +// +// Copyright (c) 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 "PGPPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSecretKeyPacket; + +@interface PGPSymmetricallyEncryptedDataPacket : PGPPacket <NSCopying> + +@property (nonatomic, copy) NSData *encryptedData; + +- (NSArray<PGPPacket *> *)decryptWithSessionKeyAlgorithm:(PGPSymmetricAlgorithm)sessionKeyAlgorithm sessionKeyData:(NSData *)sessionKeyData error:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..352377a65eb7cd5b2b552bccf39eb063ddd19e59 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h @@ -0,0 +1,25 @@ +// +// Copyright (c) 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 "PGPPacket.h" +#import "PGPSymmetricallyEncryptedDataPacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSecretKeyPacket; + +@interface PGPSymmetricallyEncryptedIntegrityProtectedDataPacket : PGPSymmetricallyEncryptedDataPacket + +@property (nonatomic, readonly) NSUInteger version; + +- (BOOL)encrypt:(NSData *)literalPacketData symmetricAlgorithm:(PGPSymmetricAlgorithm)sessionKeyAlgorithm sessionKeyData:(NSData *)sessionKeyData error:(NSError * __autoreleasing *)error; +- (NSArray<PGPPacket *> *)decryptWithSessionKeyAlgorithm:(PGPSymmetricAlgorithm)sessionKeyAlgorithm sessionKeyData:(NSData *)sessionKeyData error:(NSError * __autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPTrustPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPTrustPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..b7ddcf585f0fc04bc691329f47a8a52756196aae --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPTrustPacket.h @@ -0,0 +1,17 @@ +// +// Copyright (c) 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. +// +// Tag 12 + +#import "PGPPacketFactory.h" +#import <Foundation/Foundation.h> + +@interface PGPTrustPacket : PGPPacket <NSCopying> + +@property (nonatomic, copy, readonly) NSData *data; + +@end diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUser+Private.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUser+Private.h new file mode 100644 index 0000000000000000000000000000000000000000..f5868fded7ffa863e3cd50bfb1cc846a957bbdec --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUser+Private.h @@ -0,0 +1,32 @@ +// Copyright (c) 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 "PGPUser.h" +#import "PGPUserIDPacket.h" +#import "PGPUserAttributePacket.h" +#import "PGPSignaturePacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPUser () + +@property (nonatomic, copy) NSArray<PGPSignaturePacket *> *selfCertifications; +@property (nonatomic, copy) NSArray<PGPSignaturePacket *> *otherSignatures; +@property (nonatomic, copy) NSArray<PGPSignaturePacket *> *revocationSignatures; + +@property (nonatomic, copy, nullable) PGPUserAttributePacket *userAttribute; +@property (nonatomic, copy, readonly) PGPUserIDPacket *userIDPacket; + +@property (nonatomic, readonly) NSArray<PGPPacket *> *allPackets; + +- (instancetype)initWithUserIDPacket:(PGPUserIDPacket *)userPacket NS_DESIGNATED_INITIALIZER; + +- (nullable PGPSignaturePacket *)latestSelfCertificate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeImageSubpacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeImageSubpacket.h new file mode 100644 index 0000000000000000000000000000000000000000..dfd3e8a614632a38d44b31270480027c87f37082 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeImageSubpacket.h @@ -0,0 +1,18 @@ +// Copyright (c) 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 "PGPUserAttributeSubpacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPUserAttributeImageSubpacket : PGPUserAttributeSubpacket + +@property (nonatomic, nullable) NSData *image; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributePacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributePacket.h new file mode 100644 index 0000000000000000000000000000000000000000..820bd7407c2ea5f226b3e7ab9d5f2d71f68e1e45 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributePacket.h @@ -0,0 +1,20 @@ +// +// Copyright (c) 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 <ObjectivePGP/PGPUserAttributeSubpacket.h> +#import <ObjectivePGP/PGPPacket.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPUserAttributePacket : PGPPacket <NSCopying> + +@property (nonatomic, copy) NSArray<PGPUserAttributeSubpacket *> *subpackets; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeSubpacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeSubpacket.h new file mode 100644 index 0000000000000000000000000000000000000000..9257e1b38db7b6e0d21396d2be777dd3e98dd551 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeSubpacket.h @@ -0,0 +1,22 @@ +// +// Copyright (c) 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> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPUserAttributeSubpacket : NSObject <NSCopying> + +// Subpacket types 100 through 110 are reserved for private or experimental use. +@property (nonatomic) UInt8 type; +// Value +@property (nonatomic, copy) NSData *valueData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserIDPacket.h b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserIDPacket.h new file mode 100644 index 0000000000000000000000000000000000000000..67ea33d23303cae16f22b874255d79e93985afdb --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/PrivateHeaders/PGPUserIDPacket.h @@ -0,0 +1,26 @@ +// +// Copyright (c) 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. +// +// Tag 13 + +#import <ObjectivePGP/PGPMacros.h> +#import <ObjectivePGP/PGPPacket.h> +#import <Foundation/Foundation.h> + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPUserIDPacket : PGPPacket <NSCopying, PGPExportable> + +@property (nonatomic, copy, readonly) NSString *userID; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithUserID:(NSString *)userID NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/enzevalos_iphone/ObjectivePGP.framework/README.md b/enzevalos_iphone/ObjectivePGP.framework/README.md new file mode 100644 index 0000000000000000000000000000000000000000..074ab3e1fdb2c58be2abebcac7d5b4d92982f15d --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/README.md @@ -0,0 +1,234 @@ + + +[](https://cocoapods.org/pods/ObjectivePGP) +[](http://cocoadocs.org/docsets/ObjectivePGP) +[](./ObjectivePGP.playground/Contents.swift) +[](http://twitter.com/krzyzanowskim) + + +**ObjectivePGP** is an implementation of [OpenPGP](https://en.wikipedia.org/wiki/Pretty_Good_Privacy#OpenPGP) protocol for iOS and macOS. OpenPGP is the most widely used email encryption standard. It is defined by the OpenPGP Working Group of the Internet Engineering Task Force (IETF). + +Here is the [blog post](http://blog.krzyzanowskim.com/2014/07/31/short-story-about-openpgp-for-ios-and-os-x-objectivepgp/) story. + +## How do I get involved? + +You want to help, great! Go ahead and fork our repo, make your changes and send us a pull request. + +## Contribution + +You are welcome to contribute. See [CONTRIBUTING.md](https://github.com/krzyzanowskim/ObjectivePGP/blob/master/CONTRIBUTING.md) +Please create [Pull Request](https://github.com/krzyzanowskim/ObjectivePGP/pulls). + +## The license + +The ObjectivePGP stays under a dual license: + +- Free for non-commercial use, covered by the variant of BSD license. That means you have to mention Marcin Krzyżanowski as the original author of this code and reproduce the [LICENSE](./LICENSE.txt) text inside your app. + +- Commercial-use license to use in commercial products. Please bear in mind that some free products remain commercial products. Please contact me via [email](http://www.krzyzanowskim.com) for details. + + +Not sure what to choose? check [FAQ](https://github.com/krzyzanowskim/ObjectivePGP/wiki/FAQ) + +## Usage + +```objective-c +#import <ObjectivePGP/ObjectivePGP.h> +``` + +```swift +import ObjectivePGP +``` + +##### Read keys (private or public) + +```objective-c +NSArray<PGPKey *> *keys = [ObjectivePGP readKeysFromPath:@"/path/to/key.asc" error:nil]; +``` + +```swift +let keys = try ObjectivePGP.readKeys(fromPath: "/path/to/key.asc") +``` + +##### Keyring + +Keyring is a storage (in memory or on disk) that keep all sorts of PGP keys. + +```objective-c +PGPKeyring *keyring = ObjectivePGP.defaultKeyring; +PGPKeyring *keyring = [[PGPKeyring alloc] init]; + +NSArray<PGPKey *> *allKeys = keyring.keys; +[keyring importKeys:@[key]]; +[keyring deleteKeys:@[key]]; + +[keyring importKey:@"979E4B03DFFE30C6" fromPath:@"/path/to/secring.gpg"]; +PGPKey *key = [keyring findKeyWithIdentifier:@"979E4B03DFFE30C6"]; +NSArray<PGPKey *> keys = [pgp findKeysForUserID:@"Name <email@example.com>"]; +``` + +```swift +let keyring = ObjectivePGP.defaultKeyring +let keyring = Keyring() + +let allKeys = keyring.keys +keyring.import(keys: [key]) +keyring.delete(keys: [key]) + +keyring.import(keyIdentifier:"979E4B03DFFE30C6", fromPath:"/path/to/secring.gpg") +if let key = keyring.findKey("979E4B03DFFE30C6") { + // key found in keyring +} + +keyring.findKeys("Name <email@example.com>").forEach(key) { + // process key +} +``` + +##### Export keys (private or public) + +```objective-c +// Write keyring to file +[[keyring export:error] writeToURL:[NSURL fileURLWithString:@"keyring.gpg"]]; + +// Public keys data +NSData *publicKeys = [keyring exportKeysOfType:PGPKeyTypePublic error:nil]; +``` + +```swift +// Write keyring to file +try keyring.export().write(to: URL(fileURLWithPath: "keyring.gpg")) + +// Public keys (Data) +let publicKeys = keyring.exportKeys(of: .public) +``` + +##### Sign & verify data (or file) + +Sign a data with a key: + +```objective-c +NSData *signature = [ObjectivePGP sign:fileContent detached:YES usingKeys:@[key] passphraseForKey:nil error:nil]; +[ObjectivePGP verify:fileContent withSignature:signature usingKeys:@[key] passphraseForKey:nil error:nil]; +``` + +```swift +let signature = try ObjectivePGP.sign(encryptedBin, detached:true, using: [key1]) +try ObjectivePGP.verify(encryptedBin, withSignature: signature, using: [key1]) +``` + +##### Encrypt & Decrypt + +```objective-c +NSData *encrypted = [ObjectivePGP encrypt:fileContent addSignature:YES usingKeys:@[key] passphraseForKey:nil error:nil]; +[ObjectivePGP decrypt:encrypted andVerifySignature:YES usingKeys:@[key] passphraseForKey:nil error:nil]; +``` + +```swift +let encrypted = try ObjectivePGP.encrypt(fileContent), addSignature: true, using: [key1, key2]) +let decrypted = try ObjectivePGP.decrypt(encrypted, andVerifySignature: true, using: [key1]) +``` + +##### Generate new key pair + +```objective-c +PGPKeyGenerator *generator = [[PGPKeyGenerator alloc] init]; +PGPKey *key = [generator generateFor:@"Marcin <marcin@example.com>" passphrase:nil]; +NSData *publicKeyData = [key export:PGPKeyTypePublic error:nil]; +NSData *secretKeyData = [key export:PGPKeyTypeSecret error:nil]; +``` + +```swift +let key = KeyGenerator().generate(for: "marcin@example.com", passphrase: "password") +let publicKey = try key.export(keyType: .public) +let secretKey = try key.export(keyType: .secret) +``` + +#### ASCII Armor + +ASCII armor is a binary-to-textual encoding converter. ASCII armor involves encasing encrypted messaging in ASCII so that they can be sent in a standard messaging format such as email. + +Example: + +``` +-----BEGIN PGP PUBLIC KEY BLOCK----- +Comment: For more info see http://www.objectivepgp.org + +[...] +-----END PGP PUBLIC KEY BLOCK----- +``` + +Class `PGPArmor` can be used to convert binary format to ASCII format + +```objective-c +NSString *armoredKey = [PGPArmor armoredData:encrypted as:PGPArmorPublicKey]; +``` + +```swift +let armoredKey = Armor.armored(Data(), as: .publicKey) +``` + +When convert manually, it is important to use right `PGPArmorType` value that define the header. It may be a tricky part so here's the cheatsheet: + +| Type data | PGPArmorType | Example | +| ---------- | --------------------- |-------- | +| Encrypted | `PGPArmorMessage` | `Armor.armored(ObjectivePGP.encrypt(...), as: .message)` | +| Decrypted | `PGPArmorMessage` | `Armor.armored(ObjectivePGP.decrypt(...), as: .message)` | +| Public key | `PGPArmorTypePublic` | `Armor.armored(key.export(), as: .publicKey)` | +| Secret key | `PGPArmorTypeSecret` | `Armor.armored(key.export(), as: .secretKey)` | + +For any result of encryption the type is `PGPArmorMessage` + +## Installation + +#### [CocoaPods](https://cocoapods.org/pods/ObjectivePGP) + +```ruby +target 'TargetName' do + use_frameworks! + pod 'ObjectivePGP' +end +``` + +#### ObjectivePGP.framework + +ObjectivePGP comes with the [Frameworks](./Frameworks) for the latest release. + +1. Download latest [ObjectivePGP.framework](https://github.com/krzyzanowskim/ObjectivePGP/releases) or build a framework with the [build-frameworks.sh](./scripts/build-frameworks.sh) script. +1. Add a New Copy Files Phase by selecting the Add icon, highlighted in Figure 4. Set the Destination field to Frameworks, and add the framework to the list (see [Embedding Frameworks In An App](https://developer.apple.com/library/content/technotes/tn2435/_index.html)). Ensure Code Sign on Copy is checked. + +1. Link framework with the target + - Add `ObjectivePGP.framework` to "**Link Binary With Libraries**" list for the target. +  +1. Link libraries and frameworks + 1. Add `Security.framework` to "**Link Binary With Libraries**" list for the target. These are system libraries. + 1. Add `libz` and `libbz2` to "**Link Binary With Libraries**" list for the target. These are system libraries. +1. In the Build Phases tab, click the + button at the top and select “New Run Script Phase”. Enter the following code into the script text field: + + + +```sh +bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/ObjectivePGP.framework/Code=8" +``` + +(The last step, is required for working around an iOS App Store bug when archiving universal binaries.) + +## Changelog + +See [CHANGELOG](./CHANGELOG) + +Known limitations: + +- Cleartext signature. + +## Security Audit + +To date the ObjectivePGP code base has undergone a complete security audit from [Cure53](https://cure53.de/). + +### Acknowledgment + +This product uses software developed by the [OpenSSL](http://www.openssl.org/) Project for use in the OpenSSL Toolkit. (http://www.openssl.org/) + +### Author + +[Marcin Krzyżanowski](http://krzyzanowskim.com) diff --git a/enzevalos_iphone/ObjectivePGP.framework/strip-frameworks.sh b/enzevalos_iphone/ObjectivePGP.framework/strip-frameworks.sh new file mode 100644 index 0000000000000000000000000000000000000000..6aaa926bfe8d50e95d7b6a77fc51222f63e47e15 --- /dev/null +++ b/enzevalos_iphone/ObjectivePGP.framework/strip-frameworks.sh @@ -0,0 +1,54 @@ +# This script strips all non-valid architectures from dynamic libraries in +# the application's `Frameworks` directory. +# +# The following environment variables are required: +# +# BUILT_PRODUCTS_DIR +# FRAMEWORKS_FOLDER_PATH +# VALID_ARCHS +# EXPANDED_CODE_SIGN_IDENTITY + + +# Signs a framework with the provided identity +code_sign() { + # Use the current code_sign_identitiy + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + echo "/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements $1" + /usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} --preserve-metadata=identifier,entitlements "$1" +} + +# Set working directory to product’s embedded frameworks +cd "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +if [ "$ACTION" = "install" ]; then + echo "Copy .bcsymbolmap files to .xcarchive" + find . -name '*.bcsymbolmap' -type f -exec mv {} "${CONFIGURATION_BUILD_DIR}" \; +else + # Delete *.bcsymbolmap files from framework bundle unless archiving + find . -name '*.bcsymbolmap' -type f -exec rm -rf "{}" +\; +fi + +echo "Stripping frameworks" + +for file in $(find . -type f -perm +111); do + # Skip non-dynamic libraries + if ! [[ "$(file "$file")" == *"dynamically linked shared library"* ]]; then + continue + fi + # Get architectures for current file + archs="$(lipo -info "${file}" | rev | cut -d ':' -f1 | rev)" + stripped="" + for arch in $archs; do + if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$file" "$file" || exit 1 + stripped="$stripped $arch" + fi + done + if [[ "$stripped" != "" ]]; then + echo "Stripped $file of architectures:$stripped" + if [ "${CODE_SIGNING_REQUIRED}" == "YES" ]; then + code_sign "${file}" + fi + fi +done \ No newline at end of file