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

Support for ECIES with temporary keys #612

Merged
merged 14 commits into from
Sep 12, 2024
Merged

Conversation

hvge
Copy link
Member

@hvge hvge commented Jul 30, 2024

This PR adds support for PowerAuth protocol version 3.3.

- Increased protocol version to 3.3
@hvge hvge changed the title Core: #604: Support for ECIES with temporary keys Support for ECIES with temporary keys Jul 30, 2024
@hvge hvge marked this pull request as ready for review September 4, 2024 11:51
@hvge hvge requested review from petrdvorak and kober32 September 4, 2024 11:51
Copy link
Member

@petrdvorak petrdvorak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK, I added several smaller comments to naming / constants (it might be easier to change HS256 to HS512 if we have this a bit more abstracted).

final String challenge = Base64.encodeToString(CryptoUtils.randomBytes(18), Base64.NO_WRAP);
final GetTemporaryKeyRequest request = new GetTemporaryKeyRequest(applicationKey, activationId, challenge);
// Prepare JWT string
final String jwtHeader = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9."; // {"alg":"HS256","typ":"JWT"} with dot separator
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Embedded constant

proj-xcode/PowerAuth2/private/PA2GetTemporaryKeyResponse.h Outdated Show resolved Hide resolved
}

- (id<PowerAuthOperationTask>) signJwtWithDevicePrivateKey:(PowerAuthAuthentication*)authentication
claims:(NSDictionary<NSString*, NSObject*>*)claims
callback:(void(^)(NSString *jwt, NSError *error))callback
{
// Prepare JWT Header
NSString * jwtHeader = @"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9."; // {"alg":"ES256","typ":"JWT"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto - embedded constant

@@ -2530,22 +2552,16 @@ public void onBiometricDialogFailed(@NonNull PowerAuthErrorException error) {
@Nullable
public ICancelable signJwtWithDevicePrivateKey(@NonNull Context context, @NonNull PowerAuthAuthentication authentication, @NonNull Map<String, Object> claims, @NonNull IJwtSignatureListener listener) {
final JsonSerialization serialization = new JsonSerialization();
final byte[] serializedClaims = serialization.serializeObject(claims);
return signDataWithDevicePrivateKey(context, authentication, serializedClaims, new IDataSignatureListener() {
final String jwtHeader = "eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCJ9"; // {"alg":"ES256","typ":"JWT"}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dtto - embedded constant

Copy link
Member

@kober32 kober32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks OK, just some remarks

include/PowerAuth/Session.h Outdated Show resolved Hide resolved
*/
@Deprecated // 1.9.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to consider - maybe we should just remove these methods instead of deprecation? If someone is coming from an older SDK than 1.8, this will lead to an immediate fail anyway (and possible support request). If the client is coming from 1.8 it will work, but I think the majority of our clients are still on 1.7 and older.

Copy link
Member Author

@hvge hvge Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have this policy since the beginning of the SDK development. In my own experience, it's better to have a working build immediately after the upgrade and then I can slowly fix the warnings. This of course expects, that the developers have some common standards applied, such as zero warnings build.

@hvge hvge merged commit 6197f6f into develop Sep 12, 2024
1 check passed
@hvge hvge deleted the issues/604-ecies-temporary-keys branch September 12, 2024 13:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants