Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

fix: add payoneer certificate to java truststore #89

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 7 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ install_dependency: &install_dependency
command: |
sed -i '/jessie-updates/d' /etc/apt/sources.list
apt update
apt install -y openssl ant git zip jq
apt install -y openssl ant git zip jq
mkdir ~/awscli
cd ~/awscli
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
Expand All @@ -18,9 +18,13 @@ install_dependency: &install_dependency
wget https://repo1.maven.org/maven2/org/codehaus/groovy/groovy-all/1.7.8/groovy-all-1.7.8.jar
wget https://repo1.maven.org/maven2/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3.jar
cd ~
wget http://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA-jdk6.zip
wget https://downloads.sourceforge.net/project/jboss/JBoss/JBoss-4.2.3.GA/jboss-4.2.3.GA-jdk6.zip
unzip jboss-4.2.3.GA-jdk6.zip
cd project

echo -n | openssl s_client -connect api.payoneer.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > api.payoneer.com.crt
keytool -import -trustcacerts -keystore $JAVA_HOME/jre/lib/security/cacerts -storepass changeit -noprompt -alias api.payoneer.com -file api.payoneer.com.crt

install_deploysuite: &install_deploysuite
name: Installation of install_deploysuite.
command: |
Expand Down Expand Up @@ -106,7 +110,7 @@ workflows:
- Hold [TC-Website-Build-Deploy]
filters:
branches:
only: [dev, reskin-payment, universal-nav, ci-script-fix, feature/PLAT-1014, fix/PLAT-1432]
only: [dev, PS-138]
- build-prod:
context : org-global
requires:
Expand Down
13 changes: 13 additions & 0 deletions src/main/com/topcoder/web/tc/controller/PayoneerServiceV4.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import java.text.DecimalFormatSymbols;
import java.text.MessageFormat;
import java.util.*;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;


/**
Expand Down Expand Up @@ -264,6 +266,17 @@ private static class HttpsRequest {
public static final int HTTP_OK = HttpsURLConnection.HTTP_OK;
public static final int HTTP_NOT_FOUND = HttpsURLConnection.HTTP_NOT_FOUND;

// set the default SSLContext for the whole JVM to use TLSv1.2
static {
try {
SSLContext context = SSLContext.getInstance("TLSv1.2");
context.init(null, null, null);
SSLContext.setDefault(context);
} catch (Exception e) {
e.printStackTrace();
}
}

public static RequestResponse send(final RequestType reqType, final String urlString, final Map<String, String> headers, final Map<String, String> requestParams, final boolean isBodyTypeJSON) throws Exception {
log.info(reqType.toString() + ": " + urlString);

Expand Down