Loading truststore and keystore using System.setProperty in java












0














I am trying to create web service call for server in ssl,in order to load the certificates,I am using System.setProperty but it is not working if I am providing it seperately for one way and two way ssl.If I am providing it in the beginning,it is working fine.



Working scenario:



System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");

call webservice for one way ssl.
call webservice for two way ssl


--



if(one way ssl)
{
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
call webservice();
}


Above two calls are working fine
Below code is not working



else if(two way ssl){
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");
call webservice for two way ssl
}









share|improve this question
























  • You say Non Working Scenario: and have some code below that. Then below that code you say Above call is working fine - so which is it? is only your first block working, and the other two not working?
    – achAmháin
    Nov 13 at 11:42










  • Ist two blocks are working,last one is not working
    – mahan07
    Nov 13 at 11:43










  • Ok so if if(one way ssl) is working, just throw an else in there then? Assuming the only other option is the mutual SSL.
    – achAmháin
    Nov 13 at 11:45










  • edited the question,u have any idea why such behaviour
    – mahan07
    Nov 13 at 11:48






  • 1




    I would guess whatever you put in else if(two way ssl){ is returning false and you might need to review whatever code that is.
    – achAmháin
    Nov 13 at 11:50
















0














I am trying to create web service call for server in ssl,in order to load the certificates,I am using System.setProperty but it is not working if I am providing it seperately for one way and two way ssl.If I am providing it in the beginning,it is working fine.



Working scenario:



System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");

call webservice for one way ssl.
call webservice for two way ssl


--



if(one way ssl)
{
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
call webservice();
}


Above two calls are working fine
Below code is not working



else if(two way ssl){
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");
call webservice for two way ssl
}









share|improve this question
























  • You say Non Working Scenario: and have some code below that. Then below that code you say Above call is working fine - so which is it? is only your first block working, and the other two not working?
    – achAmháin
    Nov 13 at 11:42










  • Ist two blocks are working,last one is not working
    – mahan07
    Nov 13 at 11:43










  • Ok so if if(one way ssl) is working, just throw an else in there then? Assuming the only other option is the mutual SSL.
    – achAmháin
    Nov 13 at 11:45










  • edited the question,u have any idea why such behaviour
    – mahan07
    Nov 13 at 11:48






  • 1




    I would guess whatever you put in else if(two way ssl){ is returning false and you might need to review whatever code that is.
    – achAmháin
    Nov 13 at 11:50














0












0








0







I am trying to create web service call for server in ssl,in order to load the certificates,I am using System.setProperty but it is not working if I am providing it seperately for one way and two way ssl.If I am providing it in the beginning,it is working fine.



Working scenario:



System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");

call webservice for one way ssl.
call webservice for two way ssl


--



if(one way ssl)
{
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
call webservice();
}


Above two calls are working fine
Below code is not working



else if(two way ssl){
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");
call webservice for two way ssl
}









share|improve this question















I am trying to create web service call for server in ssl,in order to load the certificates,I am using System.setProperty but it is not working if I am providing it seperately for one way and two way ssl.If I am providing it in the beginning,it is working fine.



Working scenario:



System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");

call webservice for one way ssl.
call webservice for two way ssl


--



if(one way ssl)
{
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
call webservice();
}


Above two calls are working fine
Below code is not working



else if(two way ssl){
System.setProperty("javax.net.ssl.trustStore", "truststore.ts");
System.setProperty("javax.net.ssl.trustStorePassword", "pwd");
System.setProperty("javax.net.ssl.keyStore", "serverkeystore.ks");
System.setProperty("javax.net.ssl.keyStorePassword", "pwd");
call webservice for two way ssl
}






java ssl soap keystore truststore






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 13 at 11:46

























asked Nov 13 at 11:40









mahan07

4043720




4043720












  • You say Non Working Scenario: and have some code below that. Then below that code you say Above call is working fine - so which is it? is only your first block working, and the other two not working?
    – achAmháin
    Nov 13 at 11:42










  • Ist two blocks are working,last one is not working
    – mahan07
    Nov 13 at 11:43










  • Ok so if if(one way ssl) is working, just throw an else in there then? Assuming the only other option is the mutual SSL.
    – achAmháin
    Nov 13 at 11:45










  • edited the question,u have any idea why such behaviour
    – mahan07
    Nov 13 at 11:48






  • 1




    I would guess whatever you put in else if(two way ssl){ is returning false and you might need to review whatever code that is.
    – achAmháin
    Nov 13 at 11:50


















  • You say Non Working Scenario: and have some code below that. Then below that code you say Above call is working fine - so which is it? is only your first block working, and the other two not working?
    – achAmháin
    Nov 13 at 11:42










  • Ist two blocks are working,last one is not working
    – mahan07
    Nov 13 at 11:43










  • Ok so if if(one way ssl) is working, just throw an else in there then? Assuming the only other option is the mutual SSL.
    – achAmháin
    Nov 13 at 11:45










  • edited the question,u have any idea why such behaviour
    – mahan07
    Nov 13 at 11:48






  • 1




    I would guess whatever you put in else if(two way ssl){ is returning false and you might need to review whatever code that is.
    – achAmháin
    Nov 13 at 11:50
















You say Non Working Scenario: and have some code below that. Then below that code you say Above call is working fine - so which is it? is only your first block working, and the other two not working?
– achAmháin
Nov 13 at 11:42




You say Non Working Scenario: and have some code below that. Then below that code you say Above call is working fine - so which is it? is only your first block working, and the other two not working?
– achAmháin
Nov 13 at 11:42












Ist two blocks are working,last one is not working
– mahan07
Nov 13 at 11:43




Ist two blocks are working,last one is not working
– mahan07
Nov 13 at 11:43












Ok so if if(one way ssl) is working, just throw an else in there then? Assuming the only other option is the mutual SSL.
– achAmháin
Nov 13 at 11:45




Ok so if if(one way ssl) is working, just throw an else in there then? Assuming the only other option is the mutual SSL.
– achAmháin
Nov 13 at 11:45












edited the question,u have any idea why such behaviour
– mahan07
Nov 13 at 11:48




edited the question,u have any idea why such behaviour
– mahan07
Nov 13 at 11:48




1




1




I would guess whatever you put in else if(two way ssl){ is returning false and you might need to review whatever code that is.
– achAmháin
Nov 13 at 11:50




I would guess whatever you put in else if(two way ssl){ is returning false and you might need to review whatever code that is.
– achAmháin
Nov 13 at 11:50

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280246%2floading-truststore-and-keystore-using-system-setproperty-in-java%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53280246%2floading-truststore-and-keystore-using-system-setproperty-in-java%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)