diff --git a/Frameworks/ios/ObjectivePGP.framework/Headers b/Frameworks/ios/ObjectivePGP.framework/Headers new file mode 120000 index 00000000..a177d2a6 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/Frameworks/ios/ObjectivePGP.framework/ObjectivePGP b/Frameworks/ios/ObjectivePGP.framework/ObjectivePGP new file mode 120000 index 00000000..2be0ea41 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/ObjectivePGP @@ -0,0 +1 @@ +Versions/Current/ObjectivePGP \ No newline at end of file diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/ObjectivePGP.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/ObjectivePGP.h new file mode 100644 index 00000000..db7ef077 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/ObjectivePGP.h @@ -0,0 +1,156 @@ +// +// ObjectivePGP.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 03/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFoundation.h" +#import "PGPKey.h" + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// ObjectivePGP main class. +@interface ObjectivePGP : NSObject + +/// Imported keys. +@property (strong, nonatomic, readonly) NSSet *keys; + +/** + Import keys from the file. `keys` property is updated after successfull import. + + @param path Path to the file with the keys. + @return Array of loaded keys. + */ +- (NSSet *)importKeysFromFile:(NSString *)path; + +/** + Import keys from the data. `keys` property is updated after successfull import. + + @param data Keys data. + @return Array of loaded keys. + */ +- (NSSet *)importKeysFromData:(NSData *)data; + +/** + Import key with given identifier + + @param shortKeyStringIdentifier Short (8 characters) key identifier to load. + @param path Path to the file with the keys. + @return YES on success. + */ +- (BOOL)importKey:(NSString *)shortKeyStringIdentifier fromFile:(NSString *)path; + +/** + Read keys from the data. Does not import the keys. + + @param fileData Keys data. + @return Array of parsed keys. + */ +- (NSSet *)keysFromData:(NSData *)fileData; + +/** + Read keys from the file. Does not import the keys. + + @param path Path to the keys file. + @return Array of parsed keys. + */ +- (NSSet *)keysFromFile:(NSString *)path; + +/** + Save keys of given type (public or private) to the file. + + @param type Keys type. + @param path Full path to the destination file. + @param error Error. + @return YES on success. + */ +- (BOOL)exportKeysOfType:(PGPPartialKeyType)type toFile:(NSString *)path error:(NSError *__autoreleasing _Nullable *)error; + +/** + Export key data. + + @param key Key to export. + @param armored Choose the format. Binary or Armored (armored is a string based format) + @return Data or `nil` if can't export key. + */ +- (nullable NSData *)exportKey:(PGPKey *)key armored:(BOOL)armored; + +/** + Search for string based key identifier. + + @param keyIdentifier Key identifier. Short (8 characters, e.g: 4EF122E5) or long (16 characters, e.g: 71180E514EF122E5) identifier. + @return Key instance, or `nil` if not found. + */ +- (nullable PGPKey *)findKeyForIdentifier:(NSString *)keyIdentifier; + +/** + Search for key id. + + @param keyID Key identifier. + @return Key instance or `nil` if not found. + */ +- (nullable PGPKey *)findKeyForKeyID:(PGPKeyID *)keyID; + +/** + Search for keys for given user id. + + @param userID A string based identifier (usually name with the e-mail address). + @return Array of found keys, or empty array if not found. + */ +- (NSSet *)findKeysForUserID:(NSString *)userID; + +/** + Sign data using a key. + + @param dataToSign Data to sign. + @param key Key to be used to sign. + @param passphrase Optional. Passphrase for the key. + @param detached whether output detached signature. + @param error Error. + @return Signed data, or `nil` if fail. + */ +- (nullable NSData *)signData:(NSData *)dataToSign usingKey:(PGPKey *)key passphrase:(nullable NSString *)passphrase detached:(BOOL)detached error:(NSError *__autoreleasing _Nullable *)error; + +/** + Verify signed data. Validates with the imported keys. + + @param signedData Signed data. + @param error Error + @return YES on success. + */ +- (BOOL)verifyData:(NSData *)signedData error:(NSError *__autoreleasing _Nullable *)error; + +/** + Verify signed data, with detached signature data. + + @param signedData Signed data. + @param signatureData Detached signature data. + @param error Error + @return YES on success. + */ +- (BOOL)verifyData:(NSData *)signedData withSignature:(NSData *)signatureData error:(NSError *__autoreleasing _Nullable *)error; + +/** + Verify signed data using given key. + + @param signedData Signed data. + @param signatureData Detached signature data. + @param key Key to use. + @param error Error. + @return YES on success. + */ +- (BOOL)verifyData:(NSData *)signedData withSignature:(NSData *)signatureData usingKey:(PGPKey *)key error:(NSError *__autoreleasing _Nullable *)error; + +- (nullable NSData *)encryptData:(NSData *)dataToEncrypt usingKeys:(NSArray *)keys armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error; +- (nullable NSData *)encryptData:(NSData *)dataToEncrypt usingKeys:(NSArray *)keys signWithKey:(nullable PGPKey *)signKey passphrase:(nullable NSString *)passphrase armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error; + +- (nullable NSData *)decryptData:(NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase error:(NSError *__autoreleasing _Nullable *)error; +- (nullable NSData *)decryptData:(NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase verifyWithKey:(nullable PGPKey *)key signed:(nullable BOOL *)isSigned valid:(nullable BOOL *)isValid integrityProtected:(nullable BOOL *)isIntegrityProtected error:(NSError *__autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPArmor.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPArmor.h new file mode 100644 index 00000000..ae5c1f82 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPArmor.h @@ -0,0 +1,30 @@ +// +// PGPArmor.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 18/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, PGPArmorType) { + PGPArmorTypeMessage = 1, + PGPArmorTypePublicKey = 2, + PGPArmorTypeSecretKey = 3, + PGPArmorTypeMultipartMessagePartXOfY = 4, + PGPArmorTypeMultipartMessagePartX = 5, + PGPArmorTypeSignature = 6, + PGPArmorCleartextSignedMessage = 7, // TODO: -----BEGIN PGP SIGNED MESSAGE----- +}; + +@interface PGPArmor : NSObject + ++ (NSData *)armoredData:(NSData *)dataToArmor as:(PGPArmorType)armorType part:(NSUInteger)part of:(NSUInteger)ofParts; ++ (NSData *)armoredData:(NSData *)dataToArmor as:(PGPArmorType)armorType; + ++ (NSData *)readArmoredData:(NSString *)armoredString error:(NSError *__autoreleasing *)error; + ++ (BOOL)isArmoredData:(NSData *)data; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPBigNum.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPBigNum.h new file mode 100644 index 00000000..8bfd8433 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPBigNum.h @@ -0,0 +1,16 @@ +// +// PGPBigNum.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 26/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import + +@interface PGPBigNum : NSObject + +@property (nonatomic, readonly) int bitsCount; +@property (nonatomic, readonly) int bytesCount; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPCompressedPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPCompressedPacket.h new file mode 100644 index 00000000..02649c8f --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPCryptoCFB.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPCryptoCFB.h new file mode 100644 index 00000000..d47e4c0b --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPExportableProtocol.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPExportableProtocol.h new file mode 100644 index 00000000..8e4aec98 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPExportableProtocol.h @@ -0,0 +1,19 @@ +// +// PGPExportableProtocol.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 11/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol PGPExportable + +- (nullable NSData *)export:(NSError *_Nullable __autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPFingerprint.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPFingerprint.h new file mode 100644 index 00000000..dcc81174 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPFingerprint.h @@ -0,0 +1,21 @@ +// +// PGPFingerprint.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 14/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import + +@interface PGPFingerprint : NSObject +@property (nonatomic, copy) NSData *hashedData; +@property (nonatomic, copy) NSData *keyData; + +- (instancetype)initWithData:(NSData *)data; +- (NSString *)description; +- (NSUInteger)hashLength; + +- (BOOL)isEqualToFingerprint:(PGPFingerprint *)fingerprint; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPFoundation.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPFoundation.h new file mode 100644 index 00000000..7dc63080 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPFoundation.h @@ -0,0 +1,22 @@ + +// +// PGPFoundation.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 31/05/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +#define PGPCast(obj, c) ((c * _Nullable) _pgp__cast(obj, c.class)) + +id _Nullable _pgp__cast(id _Nullable obj, Class objClass); + +@interface PGPFoundation : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKey+Private.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKey+Private.h new file mode 100644 index 00000000..79ac8103 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKey+Private.h @@ -0,0 +1,21 @@ +// +// PGPKey+Private.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 10/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPKey.h" +#import "PGPPartialKey.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPKey () + +@property (nonatomic, nullable, readwrite) PGPPartialKey *secretKey; +@property (nonatomic, nullable, readwrite) PGPPartialKey *publicKey; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKey.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKey.h new file mode 100644 index 00000000..3739092f --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKey.h @@ -0,0 +1,35 @@ +// +// PGPKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 31/05/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" +#import "PGPPartialKey.h" +#import "PGPTypes.h" + +#import "PGPExportableProtocol.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +/// Public + Private key with the same ID. +@interface PGPKey : NSObject + +PGP_EMPTY_INIT_UNAVAILABLE; + +@property (nonatomic, nullable, readonly) PGPPartialKey *secretKey; +@property (nonatomic, nullable, readonly) PGPPartialKey *publicKey; + +@property (nonatomic, readonly) BOOL isSecret; +@property (nonatomic, readonly) BOOL isPublic; + +@property (nonatomic, nullable, readonly) PGPSecretKeyPacket *signingSecretKey; + +- (instancetype)initWithSecretKey:(nullable PGPPartialKey *)secretKey publicKey:(nullable PGPPartialKey *)publicKey NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKeyID.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKeyID.h new file mode 100644 index 00000000..2e54e6fb --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPKeyID.h @@ -0,0 +1,28 @@ +// +// PGPKeyID.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFingerprint.h" +#import "PGPFoundation.h" +#import "PGPMacros.h" +#import + +@interface PGPKeyID : NSObject + +@property (readonly, copy, nonatomic) NSData *longKey; +@property (readonly, nonatomic) NSString *longKeyString; +@property (readonly, nonatomic) NSData *shortKey; +@property (readonly, nonatomic) NSString *shortKeyString; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithLongKey:(NSData *)longKeyData NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithFingerprint:(PGPFingerprint *)fingerprint; + +- (NSData *)exportKeyData; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPLiteralPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPLiteralPacket.h new file mode 100644 index 00000000..df904b66 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +@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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPLogging.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPLogging.h new file mode 100644 index 00000000..01124be8 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPMPI.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPMPI.h new file mode 100644 index 00000000..4bd8dc63 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPMPI.h @@ -0,0 +1,30 @@ +// +// OpenPGPMPI.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPBigNum.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPMPI : NSObject + +@property (nonatomic, readonly, nullable) NSString *identifier; +@property (nonatomic, readonly) PGPBigNum *bigNum; +/** + * Total bytes, header + body + */ +@property (nonatomic, readonly) NSUInteger packetLength; + +- (instancetype)initWithMPIData:(NSData *)mpiData identifier:(nullable NSString *)identifier atPosition:(NSUInteger)position; +- (instancetype)initWithData:(NSData *)dataToMPI; +- (nullable NSData *)exportMPI; +- (nullable NSData *)bodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPMacros.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPMacros.h new file mode 100644 index 00000000..50e46665 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPMacros.h @@ -0,0 +1,39 @@ +// +// PGPMacros.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 11/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#define let const __auto_type +#define var __auto_type + +#define PGP_NOESCAPE __attribute__((noescape)) + +#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 (^*block)(void)) { (*block)(); } +#pragma clang diagnostic pop diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPModificationDetectionCodePacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPModificationDetectionCodePacket.h new file mode 100644 index 00000000..b075bbc8 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPOnePassSignaturePacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPOnePassSignaturePacket.h new file mode 100644 index 00000000..c5adad92 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPOnePassSignaturePacket.h @@ -0,0 +1,20 @@ +// +// PGPOnePassSignaturePacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 29/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" + +@class PGPKeyID; + +@interface PGPOnePassSignaturePacket : PGPPacket +@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 diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEme.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEme.h new file mode 100644 index 00000000..e727f9e4 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +@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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEmsa.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEmsa.h new file mode 100644 index 00000000..95fa8ea9 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +@interface PGPPKCSEmsa : NSObject + ++ (NSData *)encode:(PGPHashAlgorithm)hashAlgorithm message:(NSData *)m encodedMessageLength:(NSUInteger)emLen error:(NSError *__autoreleasing *)error; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPacket.h new file mode 100644 index 00000000..8112574f --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPacket.h @@ -0,0 +1,37 @@ +// +// PGPPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPExportableProtocol.h" +#import "PGPTypes.h" +#import + +extern const UInt32 PGPUnknownLength; + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPacket : NSObject + +@property (nonatomic, copy, readonly) NSData *headerData; +@property (nonatomic, copy, readonly) NSData *bodyData; +@property (nonatomic) BOOL indeterminateLength; // should not be used, but gpg use it + +@property (nonatomic, readonly) PGPPacketTag tag; +@property (nonatomic, readonly) NSData *packetData; + +- (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 *)buildHeaderData:(NSData *)bodyData; ++ (NSData *)buildNewFormatLengthDataForData:(NSData *)bodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPacketFactory.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPacketFactory.h new file mode 100644 index 00000000..15f3c746 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPartialKey.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPartialKey.h new file mode 100644 index 00000000..4e352ddd --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPartialKey.h @@ -0,0 +1,66 @@ +// +// PGPTransferableKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 13/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPExportableProtocol.h" +#import "PGPKeyID.h" +#import "PGPPacket.h" +#import "PGPSignaturePacket.h" +#import "PGPTypes.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, PGPPartialKeyType) { PGPPartialKeyUnknown = 0, PGPPartialKeySecret = 1, PGPPartialKeyPublic = 2 }; + +@class PGPSecretKeyPacket; + +/// Single Private or Public key. +@interface PGPPartialKey : NSObject + +@property (nonatomic, readonly) PGPPartialKeyType type; +@property (nonatomic) PGPPacket *primaryKeyPacket; +@property (nonatomic, readonly) BOOL isEncrypted; +@property (nonatomic, copy) NSArray *users; +@property (nonatomic, copy) NSArray *subKeys; // TODO: nullable +@property (nonatomic, nullable, copy) NSArray *directSignatures; +@property (nonatomic, nullable) PGPPacket *revocationSignature; + +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (instancetype)initWithPackets:(NSArray *)packets; + +/** + * Decrypts all secret key and subkey packets + * Note: After decryption encrypted packets are replaced with new decrypted instances on key. + * Warning: It is not good idea to keep decrypted key around + * + * @param passphrase Password + * @param error error + * + * @return YES on success. + */ +- (BOOL)decrypt:(NSString *)passphrase error:(NSError *__autoreleasing *)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 *)decryptionKeyPacketWithID:(PGPKeyID *)keyID error:(NSError *__autoreleasing *)error; + +- (NSArray *)allKeyPackets; +- (PGPSymmetricAlgorithm)preferredSymmetricAlgorithm; ++ (PGPSymmetricAlgorithm)preferredSymmetricAlgorithmForKeys:(NSArray *)keys; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyEncryptedSessionKeyPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyEncryptedSessionKeyPacket.h new file mode 100644 index 00000000..3e3575b2 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 +@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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyPacket.h new file mode 100644 index 00000000..f16ac627 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +NS_ASSUME_NONNULL_BEGIN + +@class PGPMPI; + +@interface PGPPublicKeyPacket : PGPPacket + +@property (nonatomic, readonly) UInt8 version; +@property (nonatomic, readonly) NSDate *createDate; +@property (nonatomic, readonly) UInt16 V3validityPeriod; // obsolete +@property (nonatomic, readonly) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, readwrite) NSArray *publicMPIArray; + +@property (nonatomic, readonly) NSUInteger keySize; + +@property (nonatomic, readonly) PGPFingerprint *fingerprint; +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (NSData *)exportPublicPacketOldStyle; +- (NSData *)buildPublicKeyBodyData:(BOOL)forceV4; + +- (nullable PGPMPI *)publicMPI:(NSString *)identifier; +- (nullable NSData *)encryptData:(NSData *)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyRSA.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyRSA.h new file mode 100644 index 00000000..dc50f3a3 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyRSA.h @@ -0,0 +1,27 @@ +// +// PGPPublicKeyAlgorithmRSA.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 26/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSecretKeyPacket, PGPPublicKeyPacket; + +@interface PGPPublicKeyRSA : NSObject + +// 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; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicSubKeyPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPPublicSubKeyPacket.h new file mode 100644 index 00000000..1c5cbad0 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +@interface PGPPublicSubKeyPacket : PGPPublicKeyPacket + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPS2K.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPS2K.h new file mode 100644 index 00000000..73059b24 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPS2K.h @@ -0,0 +1,37 @@ +// +// PGPS2K.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 07/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFoundation.h" +#import "PGPMacros.h" +#import "PGPTypes.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPS2K : NSObject + +@property (nonatomic, readonly) PGPS2KSpecifier specifier; +@property (nonatomic, readonly) PGPHashAlgorithm hashAlgorithm; +@property (nonatomic, readonly) NSData *salt; // random 8 bytes. +@property (nonatomic, readonly) UInt32 uncodedCount; +@property (nonatomic, readonly) UInt32 codedCount; + +@property (nonatomic) NSUInteger length; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithSpecifier:(PGPS2KSpecifier)specifier hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm NS_DESIGNATED_INITIALIZER; + ++ (PGPS2K *)S2KFromData:(NSData *)data atPosition:(NSUInteger)position; + +- (nullable NSData *)produceSessionKeyWithPassphrase:(NSString *)passphrase keySize:(NSUInteger)keySize; +- (nullable NSData *)export:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSecretKeyPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSecretKeyPacket.h new file mode 100644 index 00000000..dd65d7d7 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSecretKeyPacket.h @@ -0,0 +1,37 @@ +// +// 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 + +@property (nonatomic, readonly) BOOL isEncryptedWithPassword; +@property (nonatomic, readonly) PGPS2KUsage s2kUsage; +@property (nonatomic, readonly) PGPS2K *s2k; +@property (nonatomic, readonly) PGPSymmetricAlgorithm symmetricAlgorithm; +@property (nonatomic, copy, readonly) NSData *ivData; + +/** + * Decrypt packet + * + * @param passphrase Password + * @param error error + * + * @return Decrypted key on success + */ +- (nullable PGPSecretKeyPacket *)decryptedKeyPacket:(NSString *)passphrase error:(NSError *__autoreleasing *)error; + +- (nullable PGPMPI *)secretMPI:(NSString *)identifier; +- (nullable NSData *)decryptData:(NSData *)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSecretSubKeyPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSecretSubKeyPacket.h new file mode 100644 index 00000000..7e41b00e --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSignaturePacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSignaturePacket.h new file mode 100644 index 00000000..d463c052 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSignaturePacket.h @@ -0,0 +1,71 @@ +// +// 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 + +NS_ASSUME_NONNULL_BEGIN + +@class PGPPartialKey, PGPUser, PGPUserIDPacket, PGPPublicKeyPacket, PGPKey; + +@interface PGPSignaturePacket : PGPPacket + +@property (nonatomic) UInt8 version; +@property (nonatomic) PGPSignatureType type; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic) PGPHashAlgorithm hashAlgoritm; +@property (nonatomic, readonly) NSArray *hashedSubpackets; +@property (nonatomic, readonly) NSArray *unhashedSubpackets; +@property (nonatomic) NSData *signedHashValueData; +@property (nonatomic) NSArray *signatureMPIs; + +@property (nonatomic, readonly) BOOL canBeUsedToSign; +@property (nonatomic, readonly) BOOL canBeUsedToEncrypt; + +@property (nonatomic, nullable, readonly) PGPKeyID *issuerKeyID; +@property (nonatomic, copy, readonly) NSArray *subpackets; +@property (nonatomic, nullable) NSDate *expirationDate; +@property (nonatomic, readonly) BOOL isExpired; +@property (nonatomic, nullable) NSDate *creationDate; +@property (nonatomic, readonly) BOOL isPrimaryUserID; + +/** + * 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 *)subpacketsOfType:(PGPSignatureSubpacketType)type; + +/** + * Build signature data (signature packet with subpackets). + * + * @param inputData Data to sign + * @param secretKey Secret key used to create signature + * @param error error + * + * @return YES on success. + */ +- (BOOL)signData:(NSData *)inputData secretKey:(PGPPartialKey *)secretKey error:(NSError *__autoreleasing *)error DEPRECATED_ATTRIBUTE; +- (BOOL)signData:(NSData *)inputData usingKey:(PGPKey *)key passphrase:(nullable NSString *)passphrase userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; + +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPPartialKey *)publicKey error:(NSError *__autoreleasing *)error; +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPPartialKey *)publicKey userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPPartialKey *)publicKey signingKeyPacket:(PGPPublicKeyPacket *)signingKeyPacket userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSignatureSubpacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSignatureSubpacket.h new file mode 100644 index 00000000..02a97dc0 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSignatureSubpacket.h @@ -0,0 +1,36 @@ +// +// PGPSignatureSubPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPTypes.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSignatureSubpacketHeader : NSObject +@property (nonatomic) PGPSignatureSubpacketType type; +@property (nonatomic) NSUInteger headerLength; +@property (nonatomic) NSUInteger bodyLength; +@end + +@interface PGPSignatureSubpacket : NSObject + +@property (nonatomic, readonly) NSRange bodyRange; // subrange range within parent packet + +@property (nonatomic) PGPSignatureSubpacketType type; +@property (nonatomic, readonly) id value; + +- (instancetype)initWithHeader:(PGPSignatureSubpacketHeader *)header body:(NSData *)subPacketBodyData bodyRange:(NSRange)bodyRange; ++ (PGPSignatureSubpacketHeader *)subpacketHeaderFromData:(NSData *)headerData; ++ (PGPSignatureSubpacket *)subpacketWithType:(PGPSignatureSubpacketType)type andValue:(id)value; + +- (void)parseSubpacketBody:(NSData *)packetBody; +- (nullable NSData *)exportSubpacket:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSubKey.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSubKey.h new file mode 100644 index 00000000..d912ebbe --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSubKey.h @@ -0,0 +1,29 @@ +// +// PGPSubKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 16/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPKeyID.h" +#import "PGPPacket.h" +#import "PGPPartialKey.h" +#import "PGPSignaturePacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSubKey : PGPPartialKey + +PGP_EMPTY_INIT_UNAVAILABLE + +@property (nonatomic, nullable) PGPSignaturePacket *bindingSignature; +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (instancetype)initWithPacket:(PGPPacket *)packet NS_DESIGNATED_INITIALIZER; + +- (NSArray *)allPackets; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedDataPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedDataPacket.h new file mode 100644 index 00000000..05faa6d2 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h new file mode 100644 index 00000000..06a3687e --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 *)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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPTrustPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPTrustPacket.h new file mode 100644 index 00000000..78c2a014 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +@interface PGPTrustPacket : PGPPacket + +@property (nonatomic, readonly) NSData *data; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPTypes.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPTypes.h new file mode 100644 index 00000000..9dd3d9b5 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPTypes.h @@ -0,0 +1,171 @@ +// +// PGPTypes.h +// PGPKeyring +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#pragma once + +#ifndef NS_DESIGNATED_INITIALIZER +#define NS_DESIGNATED_INITIALIZER +#endif + +static NSString *const PGPErrorDomain = @"ObjectivePGP"; + +typedef NS_ENUM(NSInteger, PGPErrorCode) { PGPErrorGeneral = -1, PGPErrorPassphraseRequired = 5, PGPErrorPassphraseInvalid = 6 }; + +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, // TODO + PGPOnePassSignaturePacketTag = 4, + PGPSecretKeyPacketTag = 5, + PGPPublicKeyPacketTag = 6, + PGPSecretSubkeyPacketTag = 7, + PGPCompressedDataPacketTag = 8, + PGPSymmetricallyEncryptedDataPacketTag = 9, // TODO + PGPMarkerPacketTag = 10, // Ignored (Obsolete Literal Packet) + PGPLiteralDataPacketTag = 11, + PGPTrustPacketTag = 12, + PGPUserIDPacketTag = 13, + PGPPublicSubkeyPacketTag = 14, + PGPUserAttributePacketTag = 17, + PGPSymmetricallyEncryptedIntegrityProtectedDataPacketTag = 18, + PGPModificationDetectionCodePacketTag = 19, +}; + +// 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, + 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 +}; + +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, // TODO + PGPSignatureSubpacketTypeEmbeddedSignature = 32 // TODO +}; + +// 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, + PGPS2KSpecifierGnuDummy = 101 // The "gnu-dummy S2K" is the marker which will tell that this file does *not* actually contain the secret key. +}; + +typedef NS_ENUM(UInt8, PGPS2KUsage) { PGPS2KUsageNone = 0, PGPS2KUsageEncryptedAndHashed = 254, PGPS2KUsageEncrypted = 255 }; diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUser.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUser.h new file mode 100644 index 00000000..7af70ec8 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUser.h @@ -0,0 +1,36 @@ +// +// PGPUser.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 15/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFoundation.h" +#import "PGPMacros.h" +#import "PGPPacket.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PGPUserIDPacket, PGPUserAttributePacket, PGPSignaturePacket, PGPPartialKey; + +@interface PGPUser : NSObject + +@property (nonatomic, copy) NSString *userID; +@property (nonatomic) PGPUserAttributePacket *userAttribute; +@property (nonatomic) NSArray *selfCertifications; +@property (nonatomic) NSArray *otherSignatures; +@property (nonatomic) NSArray *revocationSignatures; + +@property (nonatomic) PGPUserIDPacket *userIDPacket; +@property (nonatomic) NSArray *allPackets; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithUserIDPacket:(PGPUserIDPacket *)userPacket NS_DESIGNATED_INITIALIZER; +- (nullable PGPSignaturePacket *)validSelfCertificate:(PGPPartialKey *)key; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributePacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributePacket.h new file mode 100644 index 00000000..7f86d1a5 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 *subpackets; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributeSubpacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributeSubpacket.h new file mode 100644 index 00000000..515b87d3 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/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 + +@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/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUserIDPacket.h b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUserIDPacket.h new file mode 100644 index 00000000..9b03b0de --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/A/Headers/PGPUserIDPacket.h @@ -0,0 +1,17 @@ +// +// PGPUserID.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 05/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// +// Tag 13 + +#import "PGPPacketFactory.h" +#import + +@interface PGPUserIDPacket : PGPPacket + +@property (nonatomic, copy, readonly) NSString *userID; + +@end diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/A/ObjectivePGP b/Frameworks/ios/ObjectivePGP.framework/Versions/A/ObjectivePGP new file mode 100644 index 00000000..d0d910e3 Binary files /dev/null and b/Frameworks/ios/ObjectivePGP.framework/Versions/A/ObjectivePGP differ diff --git a/Frameworks/ios/ObjectivePGP.framework/Versions/Current b/Frameworks/ios/ObjectivePGP.framework/Versions/Current new file mode 120000 index 00000000..8c7e5a66 --- /dev/null +++ b/Frameworks/ios/ObjectivePGP.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file diff --git a/Frameworks/macosx/ObjectivePGP.framework/Headers b/Frameworks/macosx/ObjectivePGP.framework/Headers new file mode 120000 index 00000000..a177d2a6 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Headers @@ -0,0 +1 @@ +Versions/Current/Headers \ No newline at end of file diff --git a/Frameworks/macosx/ObjectivePGP.framework/ObjectivePGP b/Frameworks/macosx/ObjectivePGP.framework/ObjectivePGP new file mode 120000 index 00000000..2be0ea41 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/ObjectivePGP @@ -0,0 +1 @@ +Versions/Current/ObjectivePGP \ No newline at end of file diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/ObjectivePGP.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/ObjectivePGP.h new file mode 100644 index 00000000..db7ef077 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/ObjectivePGP.h @@ -0,0 +1,156 @@ +// +// ObjectivePGP.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 03/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFoundation.h" +#import "PGPKey.h" + +#import + +NS_ASSUME_NONNULL_BEGIN + +/// ObjectivePGP main class. +@interface ObjectivePGP : NSObject + +/// Imported keys. +@property (strong, nonatomic, readonly) NSSet *keys; + +/** + Import keys from the file. `keys` property is updated after successfull import. + + @param path Path to the file with the keys. + @return Array of loaded keys. + */ +- (NSSet *)importKeysFromFile:(NSString *)path; + +/** + Import keys from the data. `keys` property is updated after successfull import. + + @param data Keys data. + @return Array of loaded keys. + */ +- (NSSet *)importKeysFromData:(NSData *)data; + +/** + Import key with given identifier + + @param shortKeyStringIdentifier Short (8 characters) key identifier to load. + @param path Path to the file with the keys. + @return YES on success. + */ +- (BOOL)importKey:(NSString *)shortKeyStringIdentifier fromFile:(NSString *)path; + +/** + Read keys from the data. Does not import the keys. + + @param fileData Keys data. + @return Array of parsed keys. + */ +- (NSSet *)keysFromData:(NSData *)fileData; + +/** + Read keys from the file. Does not import the keys. + + @param path Path to the keys file. + @return Array of parsed keys. + */ +- (NSSet *)keysFromFile:(NSString *)path; + +/** + Save keys of given type (public or private) to the file. + + @param type Keys type. + @param path Full path to the destination file. + @param error Error. + @return YES on success. + */ +- (BOOL)exportKeysOfType:(PGPPartialKeyType)type toFile:(NSString *)path error:(NSError *__autoreleasing _Nullable *)error; + +/** + Export key data. + + @param key Key to export. + @param armored Choose the format. Binary or Armored (armored is a string based format) + @return Data or `nil` if can't export key. + */ +- (nullable NSData *)exportKey:(PGPKey *)key armored:(BOOL)armored; + +/** + Search for string based key identifier. + + @param keyIdentifier Key identifier. Short (8 characters, e.g: 4EF122E5) or long (16 characters, e.g: 71180E514EF122E5) identifier. + @return Key instance, or `nil` if not found. + */ +- (nullable PGPKey *)findKeyForIdentifier:(NSString *)keyIdentifier; + +/** + Search for key id. + + @param keyID Key identifier. + @return Key instance or `nil` if not found. + */ +- (nullable PGPKey *)findKeyForKeyID:(PGPKeyID *)keyID; + +/** + Search for keys for given user id. + + @param userID A string based identifier (usually name with the e-mail address). + @return Array of found keys, or empty array if not found. + */ +- (NSSet *)findKeysForUserID:(NSString *)userID; + +/** + Sign data using a key. + + @param dataToSign Data to sign. + @param key Key to be used to sign. + @param passphrase Optional. Passphrase for the key. + @param detached whether output detached signature. + @param error Error. + @return Signed data, or `nil` if fail. + */ +- (nullable NSData *)signData:(NSData *)dataToSign usingKey:(PGPKey *)key passphrase:(nullable NSString *)passphrase detached:(BOOL)detached error:(NSError *__autoreleasing _Nullable *)error; + +/** + Verify signed data. Validates with the imported keys. + + @param signedData Signed data. + @param error Error + @return YES on success. + */ +- (BOOL)verifyData:(NSData *)signedData error:(NSError *__autoreleasing _Nullable *)error; + +/** + Verify signed data, with detached signature data. + + @param signedData Signed data. + @param signatureData Detached signature data. + @param error Error + @return YES on success. + */ +- (BOOL)verifyData:(NSData *)signedData withSignature:(NSData *)signatureData error:(NSError *__autoreleasing _Nullable *)error; + +/** + Verify signed data using given key. + + @param signedData Signed data. + @param signatureData Detached signature data. + @param key Key to use. + @param error Error. + @return YES on success. + */ +- (BOOL)verifyData:(NSData *)signedData withSignature:(NSData *)signatureData usingKey:(PGPKey *)key error:(NSError *__autoreleasing _Nullable *)error; + +- (nullable NSData *)encryptData:(NSData *)dataToEncrypt usingKeys:(NSArray *)keys armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error; +- (nullable NSData *)encryptData:(NSData *)dataToEncrypt usingKeys:(NSArray *)keys signWithKey:(nullable PGPKey *)signKey passphrase:(nullable NSString *)passphrase armored:(BOOL)armored error:(NSError *__autoreleasing _Nullable *)error; + +- (nullable NSData *)decryptData:(NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase error:(NSError *__autoreleasing _Nullable *)error; +- (nullable NSData *)decryptData:(NSData *)messageDataToDecrypt passphrase:(nullable NSString *)passphrase verifyWithKey:(nullable PGPKey *)key signed:(nullable BOOL *)isSigned valid:(nullable BOOL *)isValid integrityProtected:(nullable BOOL *)isIntegrityProtected error:(NSError *__autoreleasing _Nullable *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPArmor.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPArmor.h new file mode 100644 index 00000000..ae5c1f82 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPArmor.h @@ -0,0 +1,30 @@ +// +// PGPArmor.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 18/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import + +typedef NS_ENUM(NSUInteger, PGPArmorType) { + PGPArmorTypeMessage = 1, + PGPArmorTypePublicKey = 2, + PGPArmorTypeSecretKey = 3, + PGPArmorTypeMultipartMessagePartXOfY = 4, + PGPArmorTypeMultipartMessagePartX = 5, + PGPArmorTypeSignature = 6, + PGPArmorCleartextSignedMessage = 7, // TODO: -----BEGIN PGP SIGNED MESSAGE----- +}; + +@interface PGPArmor : NSObject + ++ (NSData *)armoredData:(NSData *)dataToArmor as:(PGPArmorType)armorType part:(NSUInteger)part of:(NSUInteger)ofParts; ++ (NSData *)armoredData:(NSData *)dataToArmor as:(PGPArmorType)armorType; + ++ (NSData *)readArmoredData:(NSString *)armoredString error:(NSError *__autoreleasing *)error; + ++ (BOOL)isArmoredData:(NSData *)data; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPBigNum.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPBigNum.h new file mode 100644 index 00000000..8bfd8433 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPBigNum.h @@ -0,0 +1,16 @@ +// +// PGPBigNum.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 26/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import + +@interface PGPBigNum : NSObject + +@property (nonatomic, readonly) int bitsCount; +@property (nonatomic, readonly) int bytesCount; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPCompressedPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPCompressedPacket.h new file mode 100644 index 00000000..02649c8f --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPCryptoCFB.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPCryptoCFB.h new file mode 100644 index 00000000..d47e4c0b --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPExportableProtocol.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPExportableProtocol.h new file mode 100644 index 00000000..8e4aec98 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPExportableProtocol.h @@ -0,0 +1,19 @@ +// +// PGPExportableProtocol.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 11/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol PGPExportable + +- (nullable NSData *)export:(NSError *_Nullable __autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPFingerprint.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPFingerprint.h new file mode 100644 index 00000000..dcc81174 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPFingerprint.h @@ -0,0 +1,21 @@ +// +// PGPFingerprint.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 14/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import + +@interface PGPFingerprint : NSObject +@property (nonatomic, copy) NSData *hashedData; +@property (nonatomic, copy) NSData *keyData; + +- (instancetype)initWithData:(NSData *)data; +- (NSString *)description; +- (NSUInteger)hashLength; + +- (BOOL)isEqualToFingerprint:(PGPFingerprint *)fingerprint; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPFoundation.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPFoundation.h new file mode 100644 index 00000000..7dc63080 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPFoundation.h @@ -0,0 +1,22 @@ + +// +// PGPFoundation.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 31/05/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +#define PGPCast(obj, c) ((c * _Nullable) _pgp__cast(obj, c.class)) + +id _Nullable _pgp__cast(id _Nullable obj, Class objClass); + +@interface PGPFoundation : NSObject + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKey+Private.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKey+Private.h new file mode 100644 index 00000000..79ac8103 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKey+Private.h @@ -0,0 +1,21 @@ +// +// PGPKey+Private.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 10/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPKey.h" +#import "PGPPartialKey.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPKey () + +@property (nonatomic, nullable, readwrite) PGPPartialKey *secretKey; +@property (nonatomic, nullable, readwrite) PGPPartialKey *publicKey; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKey.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKey.h new file mode 100644 index 00000000..3739092f --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKey.h @@ -0,0 +1,35 @@ +// +// PGPKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 31/05/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" +#import "PGPPartialKey.h" +#import "PGPTypes.h" + +#import "PGPExportableProtocol.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +/// Public + Private key with the same ID. +@interface PGPKey : NSObject + +PGP_EMPTY_INIT_UNAVAILABLE; + +@property (nonatomic, nullable, readonly) PGPPartialKey *secretKey; +@property (nonatomic, nullable, readonly) PGPPartialKey *publicKey; + +@property (nonatomic, readonly) BOOL isSecret; +@property (nonatomic, readonly) BOOL isPublic; + +@property (nonatomic, nullable, readonly) PGPSecretKeyPacket *signingSecretKey; + +- (instancetype)initWithSecretKey:(nullable PGPPartialKey *)secretKey publicKey:(nullable PGPPartialKey *)publicKey NS_DESIGNATED_INITIALIZER; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKeyID.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKeyID.h new file mode 100644 index 00000000..2e54e6fb --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPKeyID.h @@ -0,0 +1,28 @@ +// +// PGPKeyID.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFingerprint.h" +#import "PGPFoundation.h" +#import "PGPMacros.h" +#import + +@interface PGPKeyID : NSObject + +@property (readonly, copy, nonatomic) NSData *longKey; +@property (readonly, nonatomic) NSString *longKeyString; +@property (readonly, nonatomic) NSData *shortKey; +@property (readonly, nonatomic) NSString *shortKeyString; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithLongKey:(NSData *)longKeyData NS_DESIGNATED_INITIALIZER; +- (instancetype)initWithFingerprint:(PGPFingerprint *)fingerprint; + +- (NSData *)exportKeyData; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPLiteralPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPLiteralPacket.h new file mode 100644 index 00000000..df904b66 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +@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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPLogging.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPLogging.h new file mode 100644 index 00000000..01124be8 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPMPI.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPMPI.h new file mode 100644 index 00000000..4bd8dc63 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPMPI.h @@ -0,0 +1,30 @@ +// +// OpenPGPMPI.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPBigNum.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPMPI : NSObject + +@property (nonatomic, readonly, nullable) NSString *identifier; +@property (nonatomic, readonly) PGPBigNum *bigNum; +/** + * Total bytes, header + body + */ +@property (nonatomic, readonly) NSUInteger packetLength; + +- (instancetype)initWithMPIData:(NSData *)mpiData identifier:(nullable NSString *)identifier atPosition:(NSUInteger)position; +- (instancetype)initWithData:(NSData *)dataToMPI; +- (nullable NSData *)exportMPI; +- (nullable NSData *)bodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPMacros.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPMacros.h new file mode 100644 index 00000000..50e46665 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPMacros.h @@ -0,0 +1,39 @@ +// +// PGPMacros.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 11/06/2017. +// Copyright © 2017 Marcin Krzyżanowski. All rights reserved. +// + +#define let const __auto_type +#define var __auto_type + +#define PGP_NOESCAPE __attribute__((noescape)) + +#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 (^*block)(void)) { (*block)(); } +#pragma clang diagnostic pop diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPModificationDetectionCodePacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPModificationDetectionCodePacket.h new file mode 100644 index 00000000..b075bbc8 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPOnePassSignaturePacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPOnePassSignaturePacket.h new file mode 100644 index 00000000..c5adad92 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPOnePassSignaturePacket.h @@ -0,0 +1,20 @@ +// +// PGPOnePassSignaturePacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 29/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPPacket.h" + +@class PGPKeyID; + +@interface PGPOnePassSignaturePacket : PGPPacket +@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 diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEme.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEme.h new file mode 100644 index 00000000..e727f9e4 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +@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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEmsa.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPKCSEmsa.h new file mode 100644 index 00000000..95fa8ea9 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +@interface PGPPKCSEmsa : NSObject + ++ (NSData *)encode:(PGPHashAlgorithm)hashAlgorithm message:(NSData *)m encodedMessageLength:(NSUInteger)emLen error:(NSError *__autoreleasing *)error; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPacket.h new file mode 100644 index 00000000..8112574f --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPacket.h @@ -0,0 +1,37 @@ +// +// PGPPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 06/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPExportableProtocol.h" +#import "PGPTypes.h" +#import + +extern const UInt32 PGPUnknownLength; + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPPacket : NSObject + +@property (nonatomic, copy, readonly) NSData *headerData; +@property (nonatomic, copy, readonly) NSData *bodyData; +@property (nonatomic) BOOL indeterminateLength; // should not be used, but gpg use it + +@property (nonatomic, readonly) PGPPacketTag tag; +@property (nonatomic, readonly) NSData *packetData; + +- (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 *)buildHeaderData:(NSData *)bodyData; ++ (NSData *)buildNewFormatLengthDataForData:(NSData *)bodyData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPacketFactory.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPacketFactory.h new file mode 100644 index 00000000..15f3c746 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPartialKey.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPartialKey.h new file mode 100644 index 00000000..4e352ddd --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPartialKey.h @@ -0,0 +1,66 @@ +// +// PGPTransferableKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 13/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPExportableProtocol.h" +#import "PGPKeyID.h" +#import "PGPPacket.h" +#import "PGPSignaturePacket.h" +#import "PGPTypes.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSUInteger, PGPPartialKeyType) { PGPPartialKeyUnknown = 0, PGPPartialKeySecret = 1, PGPPartialKeyPublic = 2 }; + +@class PGPSecretKeyPacket; + +/// Single Private or Public key. +@interface PGPPartialKey : NSObject + +@property (nonatomic, readonly) PGPPartialKeyType type; +@property (nonatomic) PGPPacket *primaryKeyPacket; +@property (nonatomic, readonly) BOOL isEncrypted; +@property (nonatomic, copy) NSArray *users; +@property (nonatomic, copy) NSArray *subKeys; // TODO: nullable +@property (nonatomic, nullable, copy) NSArray *directSignatures; +@property (nonatomic, nullable) PGPPacket *revocationSignature; + +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (instancetype)initWithPackets:(NSArray *)packets; + +/** + * Decrypts all secret key and subkey packets + * Note: After decryption encrypted packets are replaced with new decrypted instances on key. + * Warning: It is not good idea to keep decrypted key around + * + * @param passphrase Password + * @param error error + * + * @return YES on success. + */ +- (BOOL)decrypt:(NSString *)passphrase error:(NSError *__autoreleasing *)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 *)decryptionKeyPacketWithID:(PGPKeyID *)keyID error:(NSError *__autoreleasing *)error; + +- (NSArray *)allKeyPackets; +- (PGPSymmetricAlgorithm)preferredSymmetricAlgorithm; ++ (PGPSymmetricAlgorithm)preferredSymmetricAlgorithmForKeys:(NSArray *)keys; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyEncryptedSessionKeyPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyEncryptedSessionKeyPacket.h new file mode 100644 index 00000000..3e3575b2 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 +@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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyPacket.h new file mode 100644 index 00000000..f16ac627 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +NS_ASSUME_NONNULL_BEGIN + +@class PGPMPI; + +@interface PGPPublicKeyPacket : PGPPacket + +@property (nonatomic, readonly) UInt8 version; +@property (nonatomic, readonly) NSDate *createDate; +@property (nonatomic, readonly) UInt16 V3validityPeriod; // obsolete +@property (nonatomic, readonly) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, readwrite) NSArray *publicMPIArray; + +@property (nonatomic, readonly) NSUInteger keySize; + +@property (nonatomic, readonly) PGPFingerprint *fingerprint; +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (NSData *)exportPublicPacketOldStyle; +- (NSData *)buildPublicKeyBodyData:(BOOL)forceV4; + +- (nullable PGPMPI *)publicMPI:(NSString *)identifier; +- (nullable NSData *)encryptData:(NSData *)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyRSA.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyRSA.h new file mode 100644 index 00000000..dc50f3a3 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicKeyRSA.h @@ -0,0 +1,27 @@ +// +// PGPPublicKeyAlgorithmRSA.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 26/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PGPSecretKeyPacket, PGPPublicKeyPacket; + +@interface PGPPublicKeyRSA : NSObject + +// 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; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicSubKeyPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPPublicSubKeyPacket.h new file mode 100644 index 00000000..1c5cbad0 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +@interface PGPPublicSubKeyPacket : PGPPublicKeyPacket + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPS2K.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPS2K.h new file mode 100644 index 00000000..73059b24 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPS2K.h @@ -0,0 +1,37 @@ +// +// PGPS2K.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 07/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFoundation.h" +#import "PGPMacros.h" +#import "PGPTypes.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPS2K : NSObject + +@property (nonatomic, readonly) PGPS2KSpecifier specifier; +@property (nonatomic, readonly) PGPHashAlgorithm hashAlgorithm; +@property (nonatomic, readonly) NSData *salt; // random 8 bytes. +@property (nonatomic, readonly) UInt32 uncodedCount; +@property (nonatomic, readonly) UInt32 codedCount; + +@property (nonatomic) NSUInteger length; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithSpecifier:(PGPS2KSpecifier)specifier hashAlgorithm:(PGPHashAlgorithm)hashAlgorithm NS_DESIGNATED_INITIALIZER; + ++ (PGPS2K *)S2KFromData:(NSData *)data atPosition:(NSUInteger)position; + +- (nullable NSData *)produceSessionKeyWithPassphrase:(NSString *)passphrase keySize:(NSUInteger)keySize; +- (nullable NSData *)export:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSecretKeyPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSecretKeyPacket.h new file mode 100644 index 00000000..dd65d7d7 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSecretKeyPacket.h @@ -0,0 +1,37 @@ +// +// 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 + +@property (nonatomic, readonly) BOOL isEncryptedWithPassword; +@property (nonatomic, readonly) PGPS2KUsage s2kUsage; +@property (nonatomic, readonly) PGPS2K *s2k; +@property (nonatomic, readonly) PGPSymmetricAlgorithm symmetricAlgorithm; +@property (nonatomic, copy, readonly) NSData *ivData; + +/** + * Decrypt packet + * + * @param passphrase Password + * @param error error + * + * @return Decrypted key on success + */ +- (nullable PGPSecretKeyPacket *)decryptedKeyPacket:(NSString *)passphrase error:(NSError *__autoreleasing *)error; + +- (nullable PGPMPI *)secretMPI:(NSString *)identifier; +- (nullable NSData *)decryptData:(NSData *)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSecretSubKeyPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSecretSubKeyPacket.h new file mode 100644 index 00000000..7e41b00e --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSignaturePacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSignaturePacket.h new file mode 100644 index 00000000..d463c052 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSignaturePacket.h @@ -0,0 +1,71 @@ +// +// 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 + +NS_ASSUME_NONNULL_BEGIN + +@class PGPPartialKey, PGPUser, PGPUserIDPacket, PGPPublicKeyPacket, PGPKey; + +@interface PGPSignaturePacket : PGPPacket + +@property (nonatomic) UInt8 version; +@property (nonatomic) PGPSignatureType type; +@property (nonatomic) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic) PGPHashAlgorithm hashAlgoritm; +@property (nonatomic, readonly) NSArray *hashedSubpackets; +@property (nonatomic, readonly) NSArray *unhashedSubpackets; +@property (nonatomic) NSData *signedHashValueData; +@property (nonatomic) NSArray *signatureMPIs; + +@property (nonatomic, readonly) BOOL canBeUsedToSign; +@property (nonatomic, readonly) BOOL canBeUsedToEncrypt; + +@property (nonatomic, nullable, readonly) PGPKeyID *issuerKeyID; +@property (nonatomic, copy, readonly) NSArray *subpackets; +@property (nonatomic, nullable) NSDate *expirationDate; +@property (nonatomic, readonly) BOOL isExpired; +@property (nonatomic, nullable) NSDate *creationDate; +@property (nonatomic, readonly) BOOL isPrimaryUserID; + +/** + * 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 *)subpacketsOfType:(PGPSignatureSubpacketType)type; + +/** + * Build signature data (signature packet with subpackets). + * + * @param inputData Data to sign + * @param secretKey Secret key used to create signature + * @param error error + * + * @return YES on success. + */ +- (BOOL)signData:(NSData *)inputData secretKey:(PGPPartialKey *)secretKey error:(NSError *__autoreleasing *)error DEPRECATED_ATTRIBUTE; +- (BOOL)signData:(NSData *)inputData usingKey:(PGPKey *)key passphrase:(nullable NSString *)passphrase userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; + +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPPartialKey *)publicKey error:(NSError *__autoreleasing *)error; +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPPartialKey *)publicKey userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; +- (BOOL)verifyData:(NSData *)inputData withKey:(PGPPartialKey *)publicKey signingKeyPacket:(PGPPublicKeyPacket *)signingKeyPacket userID:(nullable NSString *)userID error:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSignatureSubpacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSignatureSubpacket.h new file mode 100644 index 00000000..02a97dc0 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSignatureSubpacket.h @@ -0,0 +1,36 @@ +// +// PGPSignatureSubPacket.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPTypes.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSignatureSubpacketHeader : NSObject +@property (nonatomic) PGPSignatureSubpacketType type; +@property (nonatomic) NSUInteger headerLength; +@property (nonatomic) NSUInteger bodyLength; +@end + +@interface PGPSignatureSubpacket : NSObject + +@property (nonatomic, readonly) NSRange bodyRange; // subrange range within parent packet + +@property (nonatomic) PGPSignatureSubpacketType type; +@property (nonatomic, readonly) id value; + +- (instancetype)initWithHeader:(PGPSignatureSubpacketHeader *)header body:(NSData *)subPacketBodyData bodyRange:(NSRange)bodyRange; ++ (PGPSignatureSubpacketHeader *)subpacketHeaderFromData:(NSData *)headerData; ++ (PGPSignatureSubpacket *)subpacketWithType:(PGPSignatureSubpacketType)type andValue:(id)value; + +- (void)parseSubpacketBody:(NSData *)packetBody; +- (nullable NSData *)exportSubpacket:(NSError *__autoreleasing *)error; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSubKey.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSubKey.h new file mode 100644 index 00000000..d912ebbe --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSubKey.h @@ -0,0 +1,29 @@ +// +// PGPSubKey.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 16/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPKeyID.h" +#import "PGPPacket.h" +#import "PGPPartialKey.h" +#import "PGPSignaturePacket.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface PGPSubKey : PGPPartialKey + +PGP_EMPTY_INIT_UNAVAILABLE + +@property (nonatomic, nullable) PGPSignaturePacket *bindingSignature; +@property (nonatomic, readonly) PGPKeyID *keyID; + +- (instancetype)initWithPacket:(PGPPacket *)packet NS_DESIGNATED_INITIALIZER; + +- (NSArray *)allPackets; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedDataPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedDataPacket.h new file mode 100644 index 00000000..05faa6d2 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPSymmetricallyEncryptedIntegrityProtectedDataPacket.h new file mode 100644 index 00000000..06a3687e --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 *)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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPTrustPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPTrustPacket.h new file mode 100644 index 00000000..78c2a014 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +@interface PGPTrustPacket : PGPPacket + +@property (nonatomic, readonly) NSData *data; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPTypes.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPTypes.h new file mode 100644 index 00000000..9dd3d9b5 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPTypes.h @@ -0,0 +1,171 @@ +// +// PGPTypes.h +// PGPKeyring +// +// Created by Marcin Krzyzanowski on 04/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#pragma once + +#ifndef NS_DESIGNATED_INITIALIZER +#define NS_DESIGNATED_INITIALIZER +#endif + +static NSString *const PGPErrorDomain = @"ObjectivePGP"; + +typedef NS_ENUM(NSInteger, PGPErrorCode) { PGPErrorGeneral = -1, PGPErrorPassphraseRequired = 5, PGPErrorPassphraseInvalid = 6 }; + +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, // TODO + PGPOnePassSignaturePacketTag = 4, + PGPSecretKeyPacketTag = 5, + PGPPublicKeyPacketTag = 6, + PGPSecretSubkeyPacketTag = 7, + PGPCompressedDataPacketTag = 8, + PGPSymmetricallyEncryptedDataPacketTag = 9, // TODO + PGPMarkerPacketTag = 10, // Ignored (Obsolete Literal Packet) + PGPLiteralDataPacketTag = 11, + PGPTrustPacketTag = 12, + PGPUserIDPacketTag = 13, + PGPPublicSubkeyPacketTag = 14, + PGPUserAttributePacketTag = 17, + PGPSymmetricallyEncryptedIntegrityProtectedDataPacketTag = 18, + PGPModificationDetectionCodePacketTag = 19, +}; + +// 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, + 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 +}; + +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, // TODO + PGPSignatureSubpacketTypeEmbeddedSignature = 32 // TODO +}; + +// 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, + PGPS2KSpecifierGnuDummy = 101 // The "gnu-dummy S2K" is the marker which will tell that this file does *not* actually contain the secret key. +}; + +typedef NS_ENUM(UInt8, PGPS2KUsage) { PGPS2KUsageNone = 0, PGPS2KUsageEncryptedAndHashed = 254, PGPS2KUsageEncrypted = 255 }; diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUser.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUser.h new file mode 100644 index 00000000..7af70ec8 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUser.h @@ -0,0 +1,36 @@ +// +// PGPUser.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 15/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// + +#import "PGPFoundation.h" +#import "PGPMacros.h" +#import "PGPPacket.h" +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PGPUserIDPacket, PGPUserAttributePacket, PGPSignaturePacket, PGPPartialKey; + +@interface PGPUser : NSObject + +@property (nonatomic, copy) NSString *userID; +@property (nonatomic) PGPUserAttributePacket *userAttribute; +@property (nonatomic) NSArray *selfCertifications; +@property (nonatomic) NSArray *otherSignatures; +@property (nonatomic) NSArray *revocationSignatures; + +@property (nonatomic) PGPUserIDPacket *userIDPacket; +@property (nonatomic) NSArray *allPackets; + +PGP_EMPTY_INIT_UNAVAILABLE + +- (instancetype)initWithUserIDPacket:(PGPUserIDPacket *)userPacket NS_DESIGNATED_INITIALIZER; +- (nullable PGPSignaturePacket *)validSelfCertificate:(PGPPartialKey *)key; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributePacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributePacket.h new file mode 100644 index 00000000..7f86d1a5 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 *subpackets; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributeSubpacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUserAttributeSubpacket.h new file mode 100644 index 00000000..515b87d3 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/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 + +@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/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUserIDPacket.h b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUserIDPacket.h new file mode 100644 index 00000000..9b03b0de --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/Headers/PGPUserIDPacket.h @@ -0,0 +1,17 @@ +// +// PGPUserID.h +// ObjectivePGP +// +// Created by Marcin Krzyzanowski on 05/05/14. +// Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved. +// +// Tag 13 + +#import "PGPPacketFactory.h" +#import + +@interface PGPUserIDPacket : PGPPacket + +@property (nonatomic, copy, readonly) NSString *userID; + +@end diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/A/ObjectivePGP b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/ObjectivePGP new file mode 100644 index 00000000..77315015 Binary files /dev/null and b/Frameworks/macosx/ObjectivePGP.framework/Versions/A/ObjectivePGP differ diff --git a/Frameworks/macosx/ObjectivePGP.framework/Versions/Current b/Frameworks/macosx/ObjectivePGP.framework/Versions/Current new file mode 120000 index 00000000..8c7e5a66 --- /dev/null +++ b/Frameworks/macosx/ObjectivePGP.framework/Versions/Current @@ -0,0 +1 @@ +A \ No newline at end of file