diff --git a/ObjectivePGP.framework/Headers/ObjectivePGPObject.h b/ObjectivePGP.framework/Headers/ObjectivePGPObject.h index c448e10960a5b940a5c8cd59f891d8715454ade8..e596e2a0eec86d2c270893a8864356e1a3093b57 100644 --- a/ObjectivePGP.framework/Headers/ObjectivePGPObject.h +++ b/ObjectivePGP.framework/Headers/ObjectivePGPObject.h @@ -109,6 +109,8 @@ NS_ASSUME_NONNULL_BEGIN */ + (nullable NSData *)decrypt:(NSData *)data andVerifySignature:(BOOL)verifySignature usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseBlock error:(NSError * __autoreleasing _Nullable *)error; ++ (nullable NSData *)decrypt:(NSData *)data verified:(BOOL * _Nullable)verified usingKeys:(NSArray<PGPKey *> *)keys passphraseForKey:(nullable NSString * _Nullable(^NS_NOESCAPE)(PGPKey * _Nullable key))passphraseForKeyBlock decryptionError:(NSError * __autoreleasing _Nullable *)decryptionError verificationError:(NSError * __autoreleasing _Nullable *)verificationError; + /** Return list of key identifiers used in the given message. Determine keys that a message has been encrypted. diff --git a/ObjectivePGP.framework/Headers/PGPKeyGenerator.h b/ObjectivePGP.framework/Headers/PGPKeyGenerator.h index cafd5e0a5f0a69588239d72b177802b017abc5b4..45f443aaaf0b4bea1665d7621c8b54c0f5ab3565 100644 --- a/ObjectivePGP.framework/Headers/PGPKeyGenerator.h +++ b/ObjectivePGP.framework/Headers/PGPKeyGenerator.h @@ -8,11 +8,10 @@ #import <Foundation/Foundation.h> #import <ObjectivePGP/PGPTypes.h> +#import <ObjectivePGP/PGPKey.h> NS_ASSUME_NONNULL_BEGIN -@class PGPKey; - NS_SWIFT_NAME(KeyGenerator) @interface PGPKeyGenerator : NSObject @property (nonatomic) int keyBitsLength; diff --git a/ObjectivePGP.framework/Headers/PGPPartialKey.h b/ObjectivePGP.framework/Headers/PGPPartialKey.h index 506fa90ce53a1fb1b44bba7127602291c4b315a1..21990db7b408a0a2da776910ebca1da59a272c62 100644 --- a/ObjectivePGP.framework/Headers/PGPPartialKey.h +++ b/ObjectivePGP.framework/Headers/PGPPartialKey.h @@ -27,7 +27,7 @@ NS_SWIFT_NAME(PartialKey) @interface PGPPartialKey : NSObject <PGPExportable, NS @property (nonatomic, readonly) PGPKeyType type; @property (nonatomic, copy) PGPPacket *primaryKeyPacket; @property (nonatomic, copy) NSArray<PGPUser *> *users; -@property (nonatomic, copy, nullable, readonly) PGPUser *primaryUser; +@property (nonatomic, copy, nullable, readonly) PGPUser *primaryUser; // calculated @property (nonatomic, copy, readonly) NSArray<PGPPartialSubKey *> *subKeys; @property (nonatomic, copy, readonly) NSArray<PGPSignaturePacket *> *directSignatures; @property (nonatomic, nullable, copy, readonly) PGPSignaturePacket *revocationSignature; diff --git a/ObjectivePGP.framework/Info.plist b/ObjectivePGP.framework/Info.plist index 273ab2447caa80149970b16c7a317fe37bab3042..07167478d196b99ed5f2bbe3d308e80c8fee002d 100644 Binary files a/ObjectivePGP.framework/Info.plist and b/ObjectivePGP.framework/Info.plist differ diff --git a/ObjectivePGP.framework/ObjectivePGP b/ObjectivePGP.framework/ObjectivePGP index dd63de73c833ec41c1f0149c6ef8c425c5207d6c..a8326c2d5a202d74ae14728798b1b4f77c5df0b2 100755 Binary files a/ObjectivePGP.framework/ObjectivePGP and b/ObjectivePGP.framework/ObjectivePGP differ diff --git a/ObjectivePGP.framework/PrivateHeaders/NSData+compression.h b/ObjectivePGP.framework/PrivateHeaders/NSData+compression.h index 04ad632710d9e88be49e5e8b69af262d02a9ad1e..603d080adcadbb9ff4844bbaff99b49884155c1e 100644 --- a/ObjectivePGP.framework/PrivateHeaders/NSData+compression.h +++ b/ObjectivePGP.framework/PrivateHeaders/NSData+compression.h @@ -4,7 +4,6 @@ // rfc1950 (zlib format) #import <Foundation/Foundation.h> -#import <ObjectivePGP/ObjectivePGP.h> NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPPartialKey+Private.h b/ObjectivePGP.framework/PrivateHeaders/PGPPartialKey+Private.h index 8d24ac66479bc2dc6e0ba08e5068dc4ac6377703..5474dda2d64ca97665c28262e4236b692aaff859 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPPartialKey+Private.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPPartialKey+Private.h @@ -6,7 +6,7 @@ // This notice may not be removed from this file. // -#import <ObjectivePGP/ObjectivePGP.h> +#import "PGPPartialKey.h" NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPPartialSubKey+Private.h b/ObjectivePGP.framework/PrivateHeaders/PGPPartialSubKey+Private.h index 6e4ec3d25a01bc892094a15fda24d3d25c272326..b1d2ded345b7f3f3b3f91122de6c05318cb62506 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPPartialSubKey+Private.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPPartialSubKey+Private.h @@ -6,7 +6,7 @@ // This notice may not be removed from this file. // -#import <ObjectivePGP/ObjectivePGP.h> +#import "PGPPartialSubKey.h" @interface PGPPartialSubKey () diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket+Private.h b/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket+Private.h index d6b2d35c6307eebf0aa50a06d17250b585a7cadd..abbcc0068eef1195803e42886af74f4d995860da 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket+Private.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket+Private.h @@ -7,7 +7,6 @@ // #import "PGPPublicKeyPacket.h" -#import <ObjectivePGP/ObjectivePGP.h> NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket.h b/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket.h index c4b4ddaa3b3dc81a656e5e12f0a3699c551c7e32..15d602b9f30b6829880cf8cca16d76e65921010e 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPPublicKeyPacket.h @@ -8,7 +8,8 @@ // Tag 6 #import "PGPPacketFactory.h" -#import <ObjectivePGP/ObjectivePGP.h> +#import "PGPFingerprint.h" +#import "PGPKeyID.h" #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN @@ -21,6 +22,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, readonly) NSDate *createDate; @property (nonatomic, readonly) UInt16 V3validityPeriod; // obsolete @property (nonatomic, readonly) PGPPublicKeyAlgorithm publicKeyAlgorithm; +@property (nonatomic, readonly) BOOL isSupported; // generated properties @property (nonatomic, readonly) NSUInteger keySize; diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket+Private.h b/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket+Private.h index f0768163b62e7f67ebc2f824a1723a91367e4451..f27a442816909ae10474e6b3edb71697c8a213ff 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket+Private.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPSecretKeyPacket+Private.h @@ -9,7 +9,6 @@ #import "PGPPublicKeyPacket+Private.h" #import "PGPS2K.h" #import "PGPSecretKeyPacket.h" -#import <ObjectivePGP/ObjectivePGP.h> NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket+Private.h b/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket+Private.h index 9d0cf67c3049c7c954239bfa0c3d125f3ac287f3..dee6c23cbce97ae9d46b4a88c25e1ff282589645 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket+Private.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPSignaturePacket+Private.h @@ -7,7 +7,6 @@ // #import "PGPSignaturePacket.h" -#import <ObjectivePGP/ObjectivePGP.h> NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPUser+Private.h b/ObjectivePGP.framework/PrivateHeaders/PGPUser+Private.h index 8ce5f5a5559258640f99c0d4a78e112e7b0dba8d..f5868fded7ffa863e3cd50bfb1cc846a957bbdec 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPUser+Private.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPUser+Private.h @@ -5,10 +5,10 @@ // This notice may not be removed from this file. // -#import <ObjectivePGP/ObjectivePGP.h> -#import <ObjectivePGP/PGPUserIDPacket.h> -#import <ObjectivePGP/PGPUserAttributePacket.h> -#import <ObjectivePGP/PGPSignaturePacket.h> +#import "PGPUser.h" +#import "PGPUserIDPacket.h" +#import "PGPUserAttributePacket.h" +#import "PGPSignaturePacket.h" NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeImageSubpacket.h b/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeImageSubpacket.h index 3abe24d2480a38e348403ffcb60a00138c815b04..dfd3e8a614632a38d44b31270480027c87f37082 100644 --- a/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeImageSubpacket.h +++ b/ObjectivePGP.framework/PrivateHeaders/PGPUserAttributeImageSubpacket.h @@ -5,7 +5,7 @@ // This notice may not be removed from this file. // -#import <ObjectivePGP/ObjectivePGP-Private.h> +#import "PGPUserAttributeSubpacket.h" NS_ASSUME_NONNULL_BEGIN diff --git a/ObjectivePGP.framework/README.md b/ObjectivePGP.framework/README.md index 959a92ce1c8943de085fe34a33a76eccde8b7651..074ab3e1fdb2c58be2abebcac7d5b4d92982f15d 100644 --- a/ObjectivePGP.framework/README.md +++ b/ObjectivePGP.framework/README.md @@ -17,7 +17,7 @@ You want to help, great! Go ahead and fork our repo, make your changes and send ## Contribution You are welcome to contribute. See [CONTRIBUTING.md](https://github.com/krzyzanowskim/ObjectivePGP/blob/master/CONTRIBUTING.md) -Please create [Pull Request](https://github.com/krzyzanowskim/ObjectivePGP/pulls) against `develop` branch. +Please create [Pull Request](https://github.com/krzyzanowskim/ObjectivePGP/pulls). ## The license diff --git a/enzevalos_iphone/Folder+CoreDataProperties.swift b/enzevalos_iphone/Folder+CoreDataProperties.swift index f83885de0188b633bfc81164cc6d8d0dcee317a3..a1f45577d6d09965f49de8b8b165a177a8ead9b8 100644 --- a/enzevalos_iphone/Folder+CoreDataProperties.swift +++ b/enzevalos_iphone/Folder+CoreDataProperties.swift @@ -83,6 +83,29 @@ extension Folder { return text! } } + + public var minID: UInt64 { + set { + self.willChangeValue(forKey: "minUID") + self.setPrimitiveValue(NSDecimalNumber.init(value: newValue as UInt64), forKey: "minUID") + self.didChangeValue(forKey: "minUID") + } + get { + self.willAccessValue(forKey: "minUID") + let id = (self.primitiveValue(forKey: "minUID") as? NSDecimalNumber)?.uint64Value + self.didAccessValue(forKey: "minUID") + if id == nil { + var min = maxID + mailsOfFolder.forEach{ + if $0.uid < min { + min = $0.uid + } + } + return min + } + return id! + } + } } // MARK: Generated accessors for mails diff --git a/enzevalos_iphone/ItunesHandler.swift b/enzevalos_iphone/ItunesHandler.swift index d3858e42b633d1a89cb23b5fd358c5e1a778a1e9..69fa32752fd6d04cdb46c691cfe377ffdb835ebb 100644 --- a/enzevalos_iphone/ItunesHandler.swift +++ b/enzevalos_iphone/ItunesHandler.swift @@ -37,7 +37,7 @@ class ItunesKeyHandling { get { var keys: [TempKey] = [] for url in keyURL { - if let file = try? FileHandle(forReadingFrom: url){ + if let file = try? FileHandle(forReadingFrom: url) { let data = file.readDataToEndOfFile() var creationDate = Date() if let attrs = try? fileManager.attributesOfItem(atPath: url.path) as NSDictionary, let date = attrs.fileCreationDate() { diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift index cf5b012f1e4ab8214937293c5737f2a276ebe44d..ebc5e985cd789adebefe802f0878437d764b81ce 100644 --- a/enzevalos_iphone/MailHandler.swift +++ b/enzevalos_iphone/MailHandler.swift @@ -497,7 +497,8 @@ class MailHandler { return } if let parser = data { - let incomingMail = IncomingMail(rawData: parser, uID: UInt64(message.uid), folderPath: folderPath, flags: message.flags) + let id = UInt64(message.uid) + let incomingMail = IncomingMail(rawData: parser, uID: id, folderPath: folderPath, flags: message.flags) _ = incomingMail.store(keyRecord: record) } dispatchGroup.leave() @@ -1001,11 +1002,30 @@ class MailHandler { range = MCORange(location: UInt64(lastMinElem), length: UInt64(MailHandler.MAXMAILS)) requestIds.add(range) requestIds.remove(knownIds) + if folder.minID > UInt64(lastMinElem) { + folder.minID = UInt64(lastMinElem) + } } if lastMinElem < MailHandler.MAXMAILS { - range = MCORange(location: UInt64(0), length: UInt64(MailHandler.MAXMAILS)) + range = MCORange(location: UInt64(1), length: UInt64(MailHandler.MAXMAILS)) requestIds.add(range) + folder.minID = 1 + } + if multipleMails { + var (start, overflow) = folder.minID.subtractingReportingOverflow(UInt64(MailHandler.MAXMAILS)) + if overflow && folder.minID > 1 { + // 1 < folder.min < MailHandler.MAXMAILs -> start with uid = 1 + start = 1 + overflow = false + } + if !overflow { + range = MCORange(location: start, length: UInt64(MailHandler.MAXMAILS)) + requestIds.add(range) + folder.minID = start + } + } + return requestIds } diff --git a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 6.xcdatamodel/contents b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 6.xcdatamodel/contents index 1e51760750492ed8c7764b63feef7b9e3e93a573..cc6a8a2d1abaac670e7735144bd5c5683e4f5a07 100644 --- a/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 6.xcdatamodel/contents +++ b/enzevalos_iphone/enzevalos_iphone.xcdatamodeld/enzevalos_iphone 6.xcdatamodel/contents @@ -42,6 +42,7 @@ <attribute name="icon" optional="YES" attributeType="String" syncable="YES"/> <attribute name="lastUpdate" optional="YES" attributeType="Date" usesScalarValueType="NO" syncable="YES"/> <attribute name="maxID" optional="YES" attributeType="Decimal" defaultValueString="1" syncable="YES"/> + <attribute name="minUID" optional="YES" attributeType="Decimal" defaultValueString="0.0" syncable="YES"/> <attribute name="path" attributeType="String" syncable="YES"/> <attribute name="pseudonym" attributeType="String" syncable="YES"/> <attribute name="uidvalidity" optional="YES" attributeType="Decimal" defaultValueString="0.0" syncable="YES"/> @@ -161,7 +162,7 @@ <element name="Account" positionX="-315" positionY="-36" width="128" height="255"/> <element name="Attachment" positionX="-315" positionY="-36" width="128" height="210"/> <element name="EnzevalosContact" positionX="-209" positionY="198" width="128" height="120"/> - <element name="Folder" positionX="-297" positionY="-18" width="128" height="225"/> + <element name="Folder" positionX="-297" positionY="-18" width="128" height="240"/> <element name="KeyRecord" positionX="-315" positionY="-36" width="128" height="30"/> <element name="Mail_Address" positionX="-297" positionY="-18" width="128" height="210"/> <element name="PersistentKey" positionX="-315" positionY="-36" width="128" height="390"/>