|
|
|
@ -15,6 +15,11 @@
|
|
|
|
|
|
|
|
|
|
// MARK: - Helpers
|
|
|
|
|
|
|
|
|
|
// Access to initInternal
|
|
|
|
|
@interface PEPInternalSession()
|
|
|
|
|
- (instancetype)initInternal;
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
PEPDict* _Nonnull mailFromTo(PEPDict * _Nullable fromDict, PEPDict * _Nullable toDict,
|
|
|
|
|
NSString *shortMessage, NSString *longMessage, BOOL outgoing) {
|
|
|
|
|
PEPMutableDict *dict = [NSMutableDictionary dictionary];
|
|
|
|
@ -171,7 +176,7 @@ PEPInternalSession *session;
|
|
|
|
|
for(id path in [self pEpWorkFiles])
|
|
|
|
|
[self undelFile:path:restore];
|
|
|
|
|
|
|
|
|
|
session = [[PEPInternalSession alloc]init];
|
|
|
|
|
session = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
XCTAssert(session);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -228,7 +233,7 @@ PEPInternalSession *session;
|
|
|
|
|
- (void)testNestedSessions {
|
|
|
|
|
[self pEpSetUp];
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *session2 = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *session2 = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
|
|
|
|
|
session2 = nil;
|
|
|
|
|
|
|
|
|
@ -349,7 +354,7 @@ PEPInternalSession *session;
|
|
|
|
|
|
|
|
|
|
dispatch_queue_t queue = dispatch_get_global_queue(QOS_CLASS_USER_INITIATED, 0);
|
|
|
|
|
dispatch_sync(queue, ^{
|
|
|
|
|
PEPInternalSession *session2 = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *session2 = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
|
|
|
|
|
// Now simulate an update from the app, which usually only caches
|
|
|
|
|
// kPepUsername, kPepAddress and optionally kPepUserID.
|
|
|
|
@ -1280,7 +1285,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
|
|
|
|
|
for (int i = 1; i < 3; ++i) {
|
|
|
|
|
dispatch_group_async(group, queue, ^{
|
|
|
|
|
PEPInternalSession *innerSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *innerSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
[self doSomeWorkOnSession:innerSession count:i];
|
|
|
|
|
innerSession = nil;
|
|
|
|
|
});
|
|
|
|
@ -1571,7 +1576,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
// me
|
|
|
|
|
NSDictionary *accountDict = [self unarchiveDictionary:@"account_A3FC7F0A.ser"];
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
//Some key
|
|
|
|
|
[self importBundledKey:@"5CB2C182.asc" intoSession:someSession];
|
|
|
|
|
// This is the secret key for test001@peptest.ch
|
|
|
|
@ -1582,7 +1587,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
DISPATCH_QUEUE_CONCURRENT);
|
|
|
|
|
dispatch_group_t group = dispatch_group_create();
|
|
|
|
|
void (^decryptionBlock)(int) = ^(int index) {
|
|
|
|
|
PEPInternalSession *innerSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *innerSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
NSMutableDictionary *innerAccountDict = [accountDict mutableCopy];
|
|
|
|
|
[innerSession mySelf:innerAccountDict]; //Random Assertion failed: (status == PEP_STATUS_OK), function _myself, file /Users/buff/workspace/pEp/src/pEpEngine/src/keymanagement.c, line 619.
|
|
|
|
|
XCTAssertNotNil(innerAccountDict[kPepFingerprint]);
|
|
|
|
@ -1618,7 +1623,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
// me
|
|
|
|
|
NSDictionary *accountDict = [self unarchiveDictionary:@"account_A3FC7F0A.ser"];
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
//Some key
|
|
|
|
|
[self importBundledKey:@"5CB2C182.asc" intoSession:someSession];
|
|
|
|
|
// This is the secret key for test001@peptest.ch
|
|
|
|
@ -1628,7 +1633,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
dispatch_queue_t queue = dispatch_queue_create("Concurrent test queue",
|
|
|
|
|
DISPATCH_QUEUE_CONCURRENT);
|
|
|
|
|
dispatch_group_t group = dispatch_group_create();
|
|
|
|
|
PEPInternalSession *oneSessionCopiedToBlock = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *oneSessionCopiedToBlock = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
void (^decryptionBlock)(int) = ^(int index) {
|
|
|
|
|
NSMutableDictionary *innerAccountDict = [accountDict mutableCopy];
|
|
|
|
|
[oneSessionCopiedToBlock mySelf:innerAccountDict]; XCTAssertNotNil(innerAccountDict[kPepFingerprint]);
|
|
|
|
@ -1660,7 +1665,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
// me
|
|
|
|
|
NSDictionary *accountDict = [self unarchiveDictionary:@"account_A3FC7F0A.ser"];
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
//Some key
|
|
|
|
|
[self importBundledKey:@"5CB2C182.asc" intoSession:someSession];
|
|
|
|
|
// This is the secret key for test001@peptest.ch
|
|
|
|
@ -1670,7 +1675,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
dispatch_queue_t queue = dispatch_queue_create("Concurrent test queue",
|
|
|
|
|
DISPATCH_QUEUE_CONCURRENT);
|
|
|
|
|
dispatch_group_t group = dispatch_group_create();
|
|
|
|
|
__block PEPInternalSession *oneSessionCopiedToBlock = [[PEPInternalSession alloc] init];
|
|
|
|
|
__block PEPInternalSession *oneSessionCopiedToBlock = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
void (^decryptionBlock)(int) = ^(int index) {
|
|
|
|
|
NSMutableDictionary *innerAccountDict = [accountDict mutableCopy];
|
|
|
|
|
[oneSessionCopiedToBlock mySelf:innerAccountDict]; XCTAssertNotNil(innerAccountDict[kPepFingerprint]);
|
|
|
|
@ -1704,7 +1709,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
msgDict[kPepUsername] = @"some unkown user";
|
|
|
|
|
// me
|
|
|
|
|
NSDictionary *accountDict = [self unarchiveDictionary:@"account_A3FC7F0A.ser"];
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
//Some key
|
|
|
|
|
[self importBundledKey:@"5CB2C182.asc" intoSession:someSession];
|
|
|
|
|
// This is the secret key for test001@peptest.ch
|
|
|
|
@ -1714,7 +1719,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
dispatch_queue_t queue = dispatch_queue_create("Concurrent test queue",
|
|
|
|
|
DISPATCH_QUEUE_CONCURRENT);
|
|
|
|
|
__block dispatch_group_t group = dispatch_group_create();
|
|
|
|
|
PEPInternalSession *decryptSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *decryptSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
void (^decryptionBlock)(int) = ^(int index) {
|
|
|
|
|
NSMutableDictionary *innerAccountDict = [accountDict mutableCopy];
|
|
|
|
|
[decryptSession mySelf:innerAccountDict]; XCTAssertNotNil(innerAccountDict[kPepFingerprint]);
|
|
|
|
@ -1724,7 +1729,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
keys:&keys];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *decryptSession2 = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *decryptSession2 = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
void (^decryptionBlock2)() = ^() {
|
|
|
|
|
NSMutableDictionary *innerAccountDict = [accountDict mutableCopy];
|
|
|
|
|
[decryptSession2 mySelf:innerAccountDict]; XCTAssertNotNil(innerAccountDict[kPepFingerprint]);
|
|
|
|
@ -1736,7 +1741,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
|
|
|
|
|
void (^initBlock)() = ^() {
|
|
|
|
|
for (int i = 0; i < 100; ++i) {
|
|
|
|
|
PEPInternalSession *tmp = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *tmp = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -1775,7 +1780,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
// me
|
|
|
|
|
NSDictionary *accountDict = [self unarchiveDictionary:@"account_A3FC7F0A.ser"];
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
|
|
|
|
|
// This is the pub key for test001@peptest.ch
|
|
|
|
|
[self importBundledKey:@"5CB2C182.asc" intoSession:someSession];
|
|
|
|
@ -1785,7 +1790,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
|
|
|
|
|
someSession = nil;
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *workSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *workSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
|
|
|
|
|
NSMutableDictionary *innerAccountDict = [accountDict mutableCopy];
|
|
|
|
|
[workSession mySelf:innerAccountDict];
|
|
|
|
@ -1814,7 +1819,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
// me
|
|
|
|
|
NSDictionary *accountDict = [self unarchiveDictionary:@"account_A3FC7F0A.ser"];
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *someSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
|
|
|
|
|
//This is the pub key for test001@peptest.ch
|
|
|
|
|
[self importBundledKey:@"5CB2C182.asc" intoSession:someSession];
|
|
|
|
@ -1824,7 +1829,7 @@ encmsg[@"outgoing"] = @NO;
|
|
|
|
|
|
|
|
|
|
someSession = nil;
|
|
|
|
|
|
|
|
|
|
PEPInternalSession *workSession = [[PEPInternalSession alloc] init];
|
|
|
|
|
PEPInternalSession *workSession = [[PEPInternalSession alloc] initInternal];
|
|
|
|
|
|
|
|
|
|
NSMutableDictionary *innerAccountDict = [accountDict mutableCopy];
|
|
|
|
|
[workSession mySelf:innerAccountDict]; //Random Assertion failed: (status == PEP_STATUS_OK), function _myself, file /Users/buff/workspace/pEp/src/pEpEngine/src/keymanagement.c, line 619.
|
|
|
|
|