Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed public ECIES encryptor construction #634

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion proj-xcode/PowerAuth2/PowerAuthSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,7 @@ @implementation PowerAuthSDK (E2EE)
- (id<PowerAuthOperationTask>) eciesEncryptorWithScope:(PowerAuthCoreEciesEncryptorScope)scope
callback:(void (^)(PowerAuthCoreEciesEncryptor *, NSError *))callback
{
return [_keystoreService createKeyForEncryptorScope:scope callback:^(NSError * error) {
return [[self keystoreService] createKeyForEncryptorScope:scope callback:^(NSError * error) {
PowerAuthCoreEciesEncryptor * encryptor;
if (!error) {
encryptor = [self eciesEncryptorWithScope:scope error:&error];
Expand Down
32 changes: 32 additions & 0 deletions proj-xcode/PowerAuth2IntegrationTests/PowerAuthSDKDefaultTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -1363,4 +1363,36 @@ - (void) testJwtSignature
XCTAssertTrue(result);
}

#pragma mark - ECIES

- (void) testEncryptorCreation
{
CHECK_TEST_CONFIG();

PowerAuthCoreEciesEncryptor * encryptor = [AsyncHelper synchronizeAsynchronousBlock:^(AsyncHelper *waiting) {
[_sdk eciesEncryptorForApplicationScopeWithCallback:^(PowerAuthCoreEciesEncryptor * _Nullable encryptor, NSError * _Nullable error) {
XCTAssertNil(error);
[waiting reportCompletion:encryptor];
}];
}];
XCTAssertNotNil(encryptor);

PowerAuthSdkActivation * activation = [_helper createActivation:YES];
if (!activation) {
return;
}

// Re-create SDK to reset internal objects
_sdk = [_helper reCreateSdkInstanceWithConfiguration:nil keychainConfiguration:nil clientConfiguration:nil];
XCTAssertTrue(_sdk.hasValidActivation);

encryptor = [AsyncHelper synchronizeAsynchronousBlock:^(AsyncHelper *waiting) {
[_sdk eciesEncryptorForApplicationScopeWithCallback:^(PowerAuthCoreEciesEncryptor * _Nullable encryptor, NSError * _Nullable error) {
XCTAssertNil(error);
[waiting reportCompletion:encryptor];
}];
}];
XCTAssertNotNil(encryptor);
}

@end
Loading