Skip to content

Commit 8e07c2f

Browse files
added changes of network tokenization
1 parent f4674b5 commit 8e07c2f

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
1515
hs_err_pid*
1616

17+
#IDE config folders
18+
.idea
19+
1720
# build files
1821
**/target
1922
target

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
</plugin>
8484
<plugin>
8585
<artifactId>maven-dependency-plugin</artifactId>
86+
<version>3.3.0</version>
8687
<executions>
8788
<execution>
8889
<phase>package</phase>
@@ -272,7 +273,7 @@
272273
<dependency>
273274
<groupId>com.cybersource</groupId>
274275
<artifactId>AuthenticationSdk</artifactId>
275-
<version>0.0.26</version>
276+
<version>0.0.27-SNAPSHOT</version>
276277
</dependency>
277278
</dependencies>
278279

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package utilities.JWEResponse.JWEException;
2+
3+
public class JWEException extends Exception {
4+
5+
public JWEException(String message) {
6+
super(message);
7+
}
8+
9+
public JWEException(String message, Throwable throwable) {
10+
super(message, throwable);
11+
}
12+
13+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package utilities.JWEResponse;
2+
3+
import com.cybersource.authsdk.core.MerchantConfig;
4+
import org.apache.logging.log4j.LogManager;
5+
import org.apache.logging.log4j.Logger;
6+
import utilities.JWEResponse.JWEException.JWEException;
7+
8+
import java.io.IOException;
9+
import java.security.NoSuchAlgorithmException;
10+
import java.text.ParseException;
11+
12+
public class JWEUtility {
13+
private static final Logger logger = LogManager.getLogger(JWEUtility.class);
14+
15+
public static String decryptJWEResponse(String encodedResponse, MerchantConfig merchantConfig) throws JWEException {
16+
try {
17+
return com.cybersource.authsdk.util.JWEUtility.decryptJWEUsingPEM(merchantConfig, encodedResponse);
18+
} catch (NoSuchAlgorithmException exception) {
19+
logger.error("NoSuchAlgorithmException: Could not able to find the required algorithm", exception);
20+
throw new JWEException("Could not able to find the required algorithm", exception);
21+
} catch (IOException exception) {
22+
logger.error("IOException: Could not able to load the PEM Object from PEM file");
23+
throw new JWEException("Could not able to load the PEM Object from PEM file", exception);
24+
} catch (ParseException exception) {
25+
logger.error("ParseException: Unparsable decrypted response", exception);
26+
throw new JWEException("Unparsable decrypted response", exception);
27+
}
28+
catch (Exception exception) {
29+
logger.error("JWE internal SDK exception", exception);
30+
throw new JWEException("Exception occurred while decrypting the response", exception);
31+
}
32+
}
33+
}

0 commit comments

Comments
 (0)