IOSAD-93 testEncryptAndAttachPrivateKey (failing)
authorDirk Zimmermann <dirk@pep-project.org>
Wed, 16 May 2018 16:17:58 +0200
changeset 612be742db91ccb
parent 611 35c2fdba3af6
child 613 f33d0b187aea
IOSAD-93 testEncryptAndAttachPrivateKey (failing)
pEpObjCTests/PEPSessionTest.m
     1.1 --- a/pEpObjCTests/PEPSessionTest.m	Wed May 16 15:40:38 2018 +0200
     1.2 +++ b/pEpObjCTests/PEPSessionTest.m	Wed May 16 16:17:58 2018 +0200
     1.3 @@ -1179,6 +1179,54 @@
     1.4      dispatch_group_wait(identityRatingGroup, DISPATCH_TIME_FOREVER);
     1.5  }
     1.6  
     1.7 +/**
     1.8 + IOSAD-93
     1.9 + */
    1.10 +- (void)testEncryptAndAttachPrivateKey
    1.11 +{
    1.12 +    PEPSession *session = [PEPSession new];
    1.13 +
    1.14 +    PEPIdentity *identMe = [[PEPIdentity alloc]
    1.15 +                            initWithAddress:@"me-myself-and-i@pep-project.org"
    1.16 +                            userID:@"me-myself-and-i"
    1.17 +                            userName:@"pEp Me"
    1.18 +                            isOwn:YES];
    1.19 +    NSError *error = nil;
    1.20 +    XCTAssertTrue([session mySelf:identMe error:&error]);
    1.21 +    XCTAssertNil(error);
    1.22 +
    1.23 +    XCTAssertNotNil(identMe.fingerPrint);
    1.24 +
    1.25 +    NSString *fprAlice = @"4ABE3AAF59AC32CFE4F86500A9411D176FF00E97";
    1.26 +    PEPIdentity *identAlice = [self
    1.27 +                               checkImportingKeyFilePath:@"6FF00E97_sec.asc"
    1.28 +                               address:@"pep.test.alice@pep-project.org"
    1.29 +                               userID:@"alice_user_id"
    1.30 +                               fingerPrint:fprAlice
    1.31 +                               session: session];
    1.32 +    XCTAssertNotNil(identAlice);
    1.33 +
    1.34 +    NSString *shortMessage = @"whatever it may be";
    1.35 +    NSString *longMessage = [NSString stringWithFormat:@"%@ %@", shortMessage, shortMessage];
    1.36 +    PEPMessage *message = [PEPMessage new];
    1.37 +    message.from = identMe;
    1.38 +    message.to = @[identAlice];
    1.39 +    message.shortMessage = shortMessage;
    1.40 +    message.longMessage = longMessage;
    1.41 +
    1.42 +    PEP_STATUS status = PEP_KEY_NOT_FOUND;
    1.43 +    error = nil;
    1.44 +    PEPMessage *encrypted = [session
    1.45 +                             encryptMessage:message
    1.46 +                             toFpr:fprAlice
    1.47 +                             encFormat:PEP_enc_PEP
    1.48 +                             flags:0
    1.49 +                             status:&status error:&error];
    1.50 +    XCTAssertEqual(status, PEP_STATUS_OK);
    1.51 +    XCTAssertNil(error);
    1.52 +    XCTAssertNil(encrypted);
    1.53 +}
    1.54 +
    1.55  #pragma mark - configUnencryptedSubject
    1.56  
    1.57  - (void)testConfigUnencryptedSubject