Repository: wultra/powerauth-crypto
Pull request #449 (2022-12-15 13:31:42)

Issue/gpg signing


Patch:
diff --git a/.github/workflows/coverity-scan.yml b/.github/workflows/coverity-scan.yml
deleted file mode 100644
index 8a887f33..00000000
--- a/.github/workflows/coverity-scan.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-name: Run Coverity scan and upload results
-
-on:
-  workflow_dispatch:
-  schedule:
-    - cron:  '0 10 1 * *'    # monthly
-
-
-jobs:
-  coverity-scan:
-    uses: wultra/wultra-infrastructure/.github/workflows/coverity-scan.yml@develop
-    secrets: inherit
-    with:
-      project-name: ${{ github.event.repository.name }}
-      version: ${{ github.sha }}
-      description: ${{ github.ref }}
diff --git a/.github/workflows/maven-deploy.yml b/.github/workflows/maven-deploy.yml
index 716cb6a8..448745c8 100644
--- a/.github/workflows/maven-deploy.yml
+++ b/.github/workflows/maven-deploy.yml
@@ -45,4 +45,6 @@ jobs:
       release_type: ${{ inputs.release_type }}
     secrets:
       username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
-      password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
\ No newline at end of file
+      password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
+      gpg_passphrase: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
+      gpg_key: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
\ No newline at end of file
diff --git a/docs/PowerAuth-2022.12.md b/docs/PowerAuth-2022.12.md
deleted file mode 100644
index 7f3a5100..00000000
--- a/docs/PowerAuth-2022.12.md
+++ /dev/null
@@ -1,70 +0,0 @@
-# PowerAuth 2022.12
-
-## Migration guides
-
-For updating to 2022.12, please follow these migration guides:
-
-- [PowerAuth Server - Migration from version 1.3.0 to version 1.4.0](https://github.com/wultra/powerauth-server/blob/develop/docs/PowerAuth-Server-1.4.0.md)
-- [PowerAuth Push Server - Migration from version 1.3.0 to version 1.4.0](https://github.com/wultra/powerauth-push-server/blob/develop/docs/PowerAuth-Push-Server-1.4.0.md)
-- [PowerAuth Web Flow - Migration from version 1.3.0 to version 1.4.0](https://github.com/wultra/powerauth-webflow/blob/develop/docs/Web-Flow-1.4.0.md)
-
-## Components for version 2022.12
-
-### Back-End Applications
-
-| Component | Application Name | Version | Description |
-|---|---|---|---|
-| PowerAuth Server | `powerauth-java-server.war` | 1.4.0 | Core back-end component for PowerAuth stack. |
-| PowerAuth Admin | `powerauth-admin.war` | 1.4.0 | Administration console for PowerAuth Server. |
-| PowerAuth Push Server | `powerauth-push-server.war` | 1.4.0 | Simple to deploy push server for APNS and FCM. |
-| PowerAuth Web Flow | `powerauth-webflow.war` | 1.4.0 | Central web authentication page. |
-| PowerAuth Next Step | `powerauth-next-step.war` | 1.4.0 | Authorization server used for PowerAuth Web Flow component. |
-| PowerAuth Data Adapter | `powerauth-data-adapter.war` | 1.4.0 | Customization component for PowerAuth Web Flow. |
-| PowerAuth Tpp Engine | `powerauth-tpp-engine.war` | 1.4.0 | Third party provider registry and consent engine. |
-
-### Utilities
-
-| Component | Application Name | Version | Description |
-|---|---|---|---|
-| PowerAuth Command Line Tool | `powerauth-java-cmd.jar` | 1.4.0 | Command line tool for integration testing. |
-
-### Mobile Libraries
-
-| Platform | Package Name | Version | Description |
-|---|---|---|---|
-| iOS | `PowerAuth2` | 1.7.6 | A client library for iOS. |
-| watchOS | `PowerAuth2ForWatch` | 1.7.6 | A limited library for watchOS. |
-| iOS App Extensions | `PowerAuth2ForExtensions` | 1.7.6 | A limited library for iOS App Extensions. |
-| Android | `com.wultra.android.powerauth:powerauth-sdk` | 1.7.6 | A client library for Android. |
-| React Native | `react-native-powerauth-mobile-sdk` | 2.3.1 | React Native wrapper library for PowerAuth. | 
-
-### Back-End Integration Libraries
-
-| Component | Library Name |  Version | Description |
-|---|---|---|---|
-| PowerAuth RESTful Model | `powerauth-restful-model.jar` | 1.4.0 | Model classes for request and response objects used in PowerAuth Standard RESTful API. |
-| PowerAuth RESTful API Security for Spring | `powerauth-restful-security-spring.jar` | 1.4.0 | High-level integration libraries for RESTful API security, build for Spring MVC. |
-| PowerAuth SOAP Client for Spring WS | `powerauth-java-client-spring.jar` | 1.4.0 | SOAP service client for PowerAuth Server service, built using Spring WS. |
-| PowerAuth Push Server RESTful Model | `powerauth-push-model.jar` | 1.4.0 | Model classes for request and response objects used in PowerAuth Push Server. |
-| PowerAuth Push Server RESTful Client | `powerauth-push-client.jar` | 1.4.0 | Client implementation that simplifies integration with PowerAuth Push Server service. |
-| PowerAuth Data Adapter RESTful Model | `powerauth-data-adapter-model.jar` | 1.4.0 | Model classes for request and response objects used in PowerAuth Data Adapter component. |
-| PowerAuth Data Adapter Client | `powerauth-data-adapter-client.jar` | 1.4.0 | Client implementation that simplifies integration with PowerAuth Data Adapter custom component. |
-| PowerAuth Next Step RESTful Model | `powerauth-nextstep-model.jar` | 1.4.0 | Model classes for request and response objects used in PowerAuth Next Step service. |
-| PowerAuth Next Step Client | `powerauth-nextstep-client.jar` | 1.4.0 | Client implementation that simplifies integration with PowerAuth Next Step service. |
-| PowerAuth Mobile Token Model | `mtoken-model.jar` | 1.4.0 | Model classes for request and response objects used in PowerAuth Mobile Token. |
-
-### Technical Dependencies
-
-| Component | Library Name | Version | Description |
-|---|---|---|---|
-| PowerAuth Cryptography | `powerauth-java-crypto.jar` | 1.4.0 | Core cryptography implementation of the PowerAuth protocol. |
-| PowerAuth HTTP Utilities | `powerauth-java-http.jar` | 1.4.0 | Utilities used for binding PowerAuth cryptography to HTTP technology. |
-| PowerAuth Command-Line Tool Library | `powerauth-java-cmd-lib.jar` | 1.4.0 | Library used for implementation of the PowerAuth Command-Line Tool app, useful for unit testing. |
-| PowerAuth RESTful Security Spring | `powerauth-restful-security-spring.jar` | 1.4.0 | Spring integration library for RESTful API security. |
-| Wultra Java Networking Objects | `rest-model-base.jar` | 1.6.0 | Base classes for RESTful API networking, shared across all Wultra back-end projects. |
-| Wultra REST Client | `rest-client-base.jar` | 1.6.0 | Base RESTful client implementation, shared across all Wultra back-end projects. |
-| Wultra Auditing Library | `audit-base.jar` | 1.6.0 | Base auditing library, shared across all Wultra back-end projects. |
-
-## Known Issues When Updating From Older Versions
-
-_No known issues so far._
diff --git a/docs/Releases.md b/docs/Releases.md
index 8b07b1a5..fa933b35 100644
--- a/docs/Releases.md
+++ b/docs/Releases.md
@@ -12,7 +12,6 @@ In order to consolidate the information about the current versions, we have intr
 
 ## List of Releases
 
-- [PowerAuth 2022.12](./PowerAuth-2022.12.md)
 - [PowerAuth 2022.05](./PowerAuth-2022.05.md)
 - [PowerAuth 2022.04](./PowerAuth-2022.04.md)
 - [PowerAuth 2021.11](./PowerAuth-2021.11.md)
diff --git a/pom.xml b/pom.xml
index f8cf98cf..bf9d4184 100644
--- a/pom.xml
+++ b/pom.xml
@@ -25,7 +25,7 @@
 
     <groupId>io.getlime.security</groupId>
     <artifactId>powerauth-crypto-parent</artifactId>
-    <version>1.4.0</version>
+    <version>1.4.0-SNAPSHOT</version>
     <packaging>pom</packaging>
 
     <inceptionYear>2016</inceptionYear>
@@ -78,7 +78,7 @@
         <maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
         <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
         <guava.version>31.1-jre</guava.version>
-        <slf4j.version>2.0.5</slf4j.version>
+        <slf4j.version>2.0.3</slf4j.version>
         <junit.version>5.9.1</junit.version>
     </properties>
 
diff --git a/powerauth-java-crypto/pom.xml b/powerauth-java-crypto/pom.xml
index c3fec9f6..0275db2a 100644
--- a/powerauth-java-crypto/pom.xml
+++ b/powerauth-java-crypto/pom.xml
@@ -21,13 +21,13 @@
 	<modelVersion>4.0.0</modelVersion>
 
 	<artifactId>powerauth-java-crypto</artifactId>
-	<version>1.4.0</version>
+	<version>1.4.0-SNAPSHOT</version>
 	<packaging>jar</packaging>
 
 	<parent>
 		<groupId>io.getlime.security</groupId>
 		<artifactId>powerauth-crypto-parent</artifactId>
-		<version>1.4.0</version>
+		<version>1.4.0-SNAPSHOT</version>
 	</parent>
 
 	<dependencies>
@@ -47,7 +47,7 @@
 		<dependency>
 			<groupId>com.fasterxml.jackson.core</groupId>
 			<artifactId>jackson-databind</artifactId>
-			<version>2.14.1</version>
+			<version>2.13.4.2</version>
 			<scope>test</scope>
 		</dependency>
 		<dependency>
@@ -58,8 +58,8 @@
 
 		<dependency>
 			<groupId>org.bouncycastle</groupId>
-			<artifactId>bcprov-jdk18on</artifactId>
-			<version>1.72</version>
+			<artifactId>bcprov-jdk15on</artifactId>
+			<version>1.70</version>
 			<scope>provided</scope>
 		</dependency>
 	</dependencies>
diff --git a/powerauth-java-http/pom.xml b/powerauth-java-http/pom.xml
index 7293a222..07f7cd33 100644
--- a/powerauth-java-http/pom.xml
+++ b/powerauth-java-http/pom.xml
@@ -21,7 +21,7 @@
 	<modelVersion>4.0.0</modelVersion>
 
 	<artifactId>powerauth-java-http</artifactId>
-	<version>1.4.0</version>
+	<version>1.4.0-SNAPSHOT</version>
 	<name>powerauth-java-http</name>
 	<description>PowerAuth utility module for HTTP support</description>
 	<packaging>jar</packaging>
@@ -29,7 +29,7 @@
 	<parent>
 		<groupId>io.getlime.security</groupId>
 		<artifactId>powerauth-crypto-parent</artifactId>
-		<version>1.4.0</version>
+		<version>1.4.0-SNAPSHOT</version>
 	</parent>
 
 	<dependencies>
diff --git a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthEncryptionHttpHeaderValidator.java b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthEncryptionHttpHeaderValidator.java
index 78e80972..d9ed8166 100644
--- a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthEncryptionHttpHeaderValidator.java
+++ b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthEncryptionHttpHeaderValidator.java
@@ -38,7 +38,7 @@ public class PowerAuthEncryptionHttpHeaderValidator {
         }
 
         // Check application key
-        final String applicationKey = header.getApplicationKey();
+        String applicationKey = header.getApplicationKey();
         if (applicationKey == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_APPLICATION_KEY_EMPTY");
         }
@@ -48,7 +48,7 @@ public class PowerAuthEncryptionHttpHeaderValidator {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_APPLICATION_KEY_INVALID");
         }
 
-        final String activationId = header.getActivationId();
+        String activationId = header.getActivationId();
 
         // Activation ID is null in application scope, thus null value is allowed
         if (activationId != null) {
@@ -59,16 +59,12 @@ public class PowerAuthEncryptionHttpHeaderValidator {
         }
 
         // Check that version is present
-        final String version = header.getVersion();
+        String version = header.getVersion();
+
         if (version == null || version.isEmpty()) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_EMPTY");
         }
 
-        // Check that version is correct
-        if (!ValueTypeValidator.isValidProtocolVersion(version)) {
-            throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_INVALID");
-        }
-
     }
 
 }
diff --git a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthSignatureHttpHeaderValidator.java b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthSignatureHttpHeaderValidator.java
index 6f05be55..77cec811 100644
--- a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthSignatureHttpHeaderValidator.java
+++ b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthSignatureHttpHeaderValidator.java
@@ -38,7 +38,7 @@ public class PowerAuthSignatureHttpHeaderValidator {
         }
 
         // Check activation ID
-        final String activationId = header.getActivationId();
+        String activationId = header.getActivationId();
         if (activationId == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ACTIVATION_ID_EMPTY");
         }
@@ -49,7 +49,7 @@ public class PowerAuthSignatureHttpHeaderValidator {
         }
 
         // Check nonce
-        final String nonce = header.getNonce();
+        String nonce = header.getNonce();
         if (nonce == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_NONCE_EMPTY");
         }
@@ -60,7 +60,7 @@ public class PowerAuthSignatureHttpHeaderValidator {
         }
 
         // Check signature type
-        final String signatureType = header.getSignatureType();
+        String signatureType = header.getSignatureType();
         if (signatureType == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_SIGNATURE_TYPE_EMPTY");
         }
@@ -71,7 +71,7 @@ public class PowerAuthSignatureHttpHeaderValidator {
         }
 
         // Check signature
-        final String signature = header.getSignature();
+        String signature = header.getSignature();
         if (signature == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_SIGNATURE_EMPTY");
         }
@@ -82,7 +82,7 @@ public class PowerAuthSignatureHttpHeaderValidator {
         }
 
         // Check application key.
-        final String applicationKey = header.getApplicationKey();
+        String applicationKey = header.getApplicationKey();
         if (applicationKey == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_APPLICATION_EMPTY");
         }
@@ -92,17 +92,6 @@ public class PowerAuthSignatureHttpHeaderValidator {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_APPLICATION_INVALID");
         }
 
-        // Check that version is present
-        final String version = header.getVersion();
-        if (version == null || version.isEmpty()) {
-            throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_EMPTY");
-        }
-
-        // Check that version is correct
-        if (!ValueTypeValidator.isValidProtocolVersion(version)) {
-            throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_INVALID");
-        }
-
     }
 
 }
\ No newline at end of file
diff --git a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthTokenHttpHeaderValidator.java b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthTokenHttpHeaderValidator.java
index 322945e1..b8e4d925 100644
--- a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthTokenHttpHeaderValidator.java
+++ b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/PowerAuthTokenHttpHeaderValidator.java
@@ -38,7 +38,7 @@ public class PowerAuthTokenHttpHeaderValidator {
         }
 
         // Check token ID
-        final String tokenId = header.getTokenId();
+        String tokenId = header.getTokenId();
         if (tokenId == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_TOKEN_ID_EMPTY");
         }
@@ -49,7 +49,7 @@ public class PowerAuthTokenHttpHeaderValidator {
         }
 
         // Check token digest
-        final String tokenDigest = header.getTokenDigest();
+        String tokenDigest = header.getTokenDigest();
         if (tokenDigest == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_TOKEN_DIGEST_EMPTY");
         }
@@ -60,7 +60,7 @@ public class PowerAuthTokenHttpHeaderValidator {
         }
 
         // Check nonce
-        final String nonce = header.getNonce();
+        String nonce = header.getNonce();
         if (nonce == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_TOKEN_NONCE_EMPTY");
         }
@@ -71,7 +71,7 @@ public class PowerAuthTokenHttpHeaderValidator {
         }
 
         // Check timestamp
-        final String timestamp = header.getTimestamp();
+        String timestamp = header.getTimestamp();
         if (timestamp == null) {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_TOKEN_TIMESTAMP_EMPTY");
         }
@@ -81,17 +81,6 @@ public class PowerAuthTokenHttpHeaderValidator {
             throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_TOKEN_TIMESTAMP_INVALID");
         }
 
-        // Check that version is present
-        final String version = header.getVersion();
-        if (version == null || version.isEmpty()) {
-            throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_EMPTY");
-        }
-
-        // Check that version is correct
-        if (!ValueTypeValidator.isValidProtocolVersion(version)) {
-            throw new InvalidPowerAuthHttpHeaderException("POWER_AUTH_ENCRYPTION_VERSION_INVALID");
-        }
-
     }
 
 }
diff --git a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/ValueTypeValidator.java b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/ValueTypeValidator.java
index 2c2ab84a..2a6b38b6 100644
--- a/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/ValueTypeValidator.java
+++ b/powerauth-java-http/src/main/java/io/getlime/security/powerauth/http/validator/ValueTypeValidator.java
@@ -19,8 +19,7 @@ package io.getlime.security.powerauth.http.validator;
 import com.google.common.io.BaseEncoding;
 
 import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
+import java.util.List;
 
 /**
  * Utility class to validate various value types, such as UUID, base64 encoded data, etc.
@@ -29,45 +28,16 @@ import java.util.Set;
  */
 public class ValueTypeValidator {
 
-    /**
-     * Regexp for validating UUID values.
-     */
-    private static final String UUID_REGEX = "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
-
-    /**
-     * Regexp for validating decimalized signature values.
-     */
-    private static final String SIGNATURE_REGEX = "^[0-9]{8}(-[0-9]{8}){0,2}$";
-
-    /**
-     * Regexp for validating decimal strings.
-     */
-    private static final String DECIMAL_STRING_REGEX = "^[0-9]*$";
-
-    /**
-     * Admissible protocol versions in the header.
-     */
-    private static final Set<String> PROTOCOL_VERSIONS = new HashSet<>(Arrays.asList(
-            "3.1", "3.0", "2.1", "2.0"
-    ));
-
-    /**
-     * Admissible signature types in the header.
-     */
-    private static final Set<String> EXPECTED_SIGNATURE_TYPES = new HashSet<>(Arrays.asList(
-            "possession", "knowledge", "biometry",
-            "possession_knowledge", "possession_biometry",
-            "possession_knowledge_biometry"
-    ));
+    private static final String uuidRegex = "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
+    private static final String signatureRegex = "^[0-9]{8}(-[0-9]{8}){0,2}$";
 
     /**
      * Check if provided string is a valid UUID.
      * @param uuidCandidate UUID candidate.
      * @return True in case provided string is a valid UUID, false otherwise.
      */
-    @SuppressWarnings("BooleanMethodIsAlwaysInverted")
     public static boolean isValidUuid(String uuidCandidate) {
-        return uuidCandidate != null && uuidCandidate.toLowerCase().matches(UUID_REGEX);
+        return uuidCandidate != null && uuidCandidate.toLowerCase().matches(uuidRegex);
     }
 
     /**
@@ -78,7 +48,6 @@ public class ValueTypeValidator {
      * @return True in case the provided string are Base64 encoded data of expected byte length,
      * false otherwise.
      */
-    @SuppressWarnings("BooleanMethodIsAlwaysInverted")
     public static boolean isValidBase64OfLength(String base64candidate, int expectedLength) {
         final BaseEncoding base64 = BaseEncoding.base64();
         if (base64candidate != null && base64.canDecode(base64candidate)) {
@@ -114,7 +83,12 @@ public class ValueTypeValidator {
      * @return True if the provided signature type is valid.
      */
     public static boolean isValidSignatureType(String signatureType) {
-        return signatureType != null && EXPECTED_SIGNATURE_TYPES.contains(signatureType.toLowerCase());
+        List<String> expectedSignatureTypes = Arrays.asList(
+                "possession", "knowledge", "biometry",
+                "possession_knowledge", "possession_biometry",
+                "possession_knowledge_biometry"
+        );
+        return signatureType != null && expectedSignatureTypes.contains(signatureType.toLowerCase());
     }
 
     /**
@@ -129,7 +103,7 @@ public class ValueTypeValidator {
                 case 17:
                 case 26:
                     // "2.0", "2.1", "3.0" signature version uses "DECIMAL" format
-                    return signature.matches(SIGNATURE_REGEX);
+                    return signature.matches(signatureRegex);
                 case 24:
                 case 44:
                 case 64:
@@ -153,21 +127,11 @@ public class ValueTypeValidator {
      * @return True if provided string is decimal and has expected length range.
      */
     public static boolean isDecimalString(String decimalString, int from, int to) {
-        if (decimalString != null && decimalString.matches(DECIMAL_STRING_REGEX)) {
+        if (decimalString != null && decimalString.matches("^[0-9]*$")) {
             return decimalString.length() >= from && decimalString.length() <= to;
         } else {
             return false;
         }
     }
 
-    /**
-     * Check if the provided version is a valid one.
-     * @param version Version to check.
-     * @return True if provided version is valid, false otherwise.
-     */
-    @SuppressWarnings("BooleanMethodIsAlwaysInverted")
-    public static boolean isValidProtocolVersion(String version) {
-        return PROTOCOL_VERSIONS.contains(version);
-    }
-
 }


Test patch:
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java
index b4c7a62c..9eb0da72 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/lib/util/KeyConversionUtilsTest.java
@@ -19,7 +19,6 @@ package io.getlime.security.powerauth.crypto.lib.util;
 import com.google.common.io.BaseEncoding;
 import io.getlime.security.powerauth.crypto.lib.config.PowerAuthConfiguration;
 import io.getlime.security.powerauth.crypto.lib.generator.KeyGenerator;
-import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey;
 import org.bouncycastle.jce.ECNamedCurveTable;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.bouncycastle.jce.spec.ECParameterSpec;
@@ -85,7 +84,7 @@ public class KeyConversionUtilsTest {
 			String originalPrivateBase64 = BaseEncoding.base64().encode(originalPrivateBytes);
 			byte[] decodedPrivateBytes = BaseEncoding.base64().decode(originalPrivateBase64);
 			PrivateKey decodedPrivateKey = instance.convertBytesToPrivateKey(decodedPrivateBytes);
-			assertEquals(((BCECPrivateKey)privateKey).getD(), (((BCECPrivateKey)decodedPrivateKey).getD()));
+			assertEquals(privateKey, decodedPrivateKey);
 
 			KeyFactory kf = KeyFactory.getInstance("ECDH", PowerAuthConfiguration.CRYPTO_PROVIDER_NAME);
 			BigInteger keyInteger = new BigInteger("" + (12 * i));
diff --git a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java
index 245709d7..fd6785d4 100644
--- a/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java
+++ b/powerauth-java-crypto/src/test/java/io/getlime/security/powerauth/crypto/vault/VaultTest.java
@@ -23,7 +23,6 @@ import io.getlime.security.powerauth.crypto.lib.enums.PowerAuthDerivedKey;
 import io.getlime.security.powerauth.crypto.lib.generator.KeyGenerator;
 import io.getlime.security.powerauth.crypto.lib.util.KeyConvertor;
 import io.getlime.security.powerauth.crypto.server.vault.PowerAuthServerVault;
-import org.bouncycastle.jcajce.provider.asymmetric.ec.BCECPrivateKey;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -115,7 +114,7 @@ public class VaultTest {
             assertEquals(clientVaultEncryptionKey, vaultEncryptionKeyLocal);
 
             PrivateKey devicePrivateKeyLocal = clientVault.decryptDevicePrivateKey(cDevicePrivateKey, vaultEncryptionKeyLocal);
-            assertEquals(((BCECPrivateKey)deviceKeyPair.getPrivate()).getD(), ((BCECPrivateKey)devicePrivateKeyLocal).getD());
+            assertEquals(deviceKeyPair.getPrivate(), devicePrivateKeyLocal);
         }
 
     }
@@ -174,7 +173,7 @@ public class VaultTest {
         assertEquals(clientVaultEncryptionKey, vaultEncryptionKeyLocal);
 
         PrivateKey devicePrivateKeyLocal = clientVault.decryptDevicePrivateKey(cDevicePrivateKey, vaultEncryptionKeyLocal);
-        assertEquals(((BCECPrivateKey)deviceKeyPair.getPrivate()).getD(), ((BCECPrivateKey)devicePrivateKeyLocal).getD());
+        assertEquals(deviceKeyPair.getPrivate(), devicePrivateKeyLocal);
 
     }