Dynamic loading truststore certificates #130
-
Dear @phax , I used phase4-spring-boot-demo to release AS4 server now. And it runs successful.
when I add/delete a cert from test.jks, will run the following logic:
But when I add a new cert into test.jks, the server doesn't identify it, need to re-run the server. Best Regards, |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
[Based on #129] AS4XServletHandler handler = new AS4XServletHandler ();
handler.setCryptoFactorySupplier(() ->{
Path publicCertPath = new File("D:\phase4-as4\src\main\resources\test.jks").toPath()
String partnerPwd = 'test'
// Add all certificates to trust store
KeyStore trustKeyStore = AS4KeystoreUtils.load(publicCertPath, partnerPwd)
KeyStore keyStore = AS4CryptoFactoryProperties.getDefaultInstance ().getKeyStore ()
AS4CryptoFactoryInMemoryKeyStore cf = new AS4CryptoFactoryInMemoryKeyStore(keyStore, 'test','test', trustKeyStore);
return cf;
}); |
Beta Was this translation helpful? Give feedback.
-
HI @TMain-Tomi , sorry for the delayed response - I am currently on vacation. I created some stub code for you in https://github.com/phax/phase4/blob/master/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/servlet/ServletConfig.java#L67-L92 where you can see how that might work. You create your own Servlet class (MyAS4Servlet) and customize the handler there. Inside the static method of the outer class, you can add you code as above:
That means that each time a message is received, a new I hope that makes sense to you. |
Beta Was this translation helpful? Give feedback.
-
Dear @phax, Thanks for you reply. Best Regards, |
Beta Was this translation helpful? Give feedback.
-
Dear @phax, I add getCryptoFactoryToUse() and MyAS4Servlet in ServletConfig and it works normal now. Best Regards, |
Beta Was this translation helpful? Give feedback.
-
Hi @phax, I successfully used AS4ClientPullRequestMessage to pull AS4 message from other AS4(Base on Holodeck-B2B) server when this message without signture and ecryption. My code is following:
But when I add ecryption in other AS4 Server's pull message:
I don't know how to add the decryption in AS4ClientPullRequestMessage. I tried to add this, but it failed.
And if customer AS4 Server need a response, how I can do after I get optimistic response? Another problem is how to set up a pull server. If I need to save a message into MPC and wait partner to pull it, how to achieve it? May you give me some advices? Thanks. Best Regards, |
Beta Was this translation helpful? Give feedback.
HI @TMain-Tomi , sorry for the delayed response - I am currently on vacation.
I created some stub code for you in https://github.com/phax/phase4/blob/master/phase4-spring-boot-demo/src/main/java/com/helger/phase4/springboot/servlet/ServletConfig.java#L67-L92 where you can see how that might work. You create your own Servlet class (MyAS4Servlet) and customize the handler there.
Inside the static method of the outer class, you can add you code as above: