I am working with Spring integration + Spring WS Security through WSS4JSecurityInterceptor.
I have a WS client consuming a Web service on the server with the next security scenario: **
- The server side gives me a .cert file data in byte array after encoding to sign but I don’t know how to give byte array to factory.setKeyStoreLoaction(), here it is expecting the file path, but I have byte array.
Below is the configuration to load jks file from classpath
`@Bean
public Crypto myCrypto() throws Exception{
CryptoFactoryBean factory = new CryptoFactoryBean();
factory.setTrustStorePassword( "myPass" );
factory.setKeyStorePassword( "myPass" );
**factory.setKeyStoreLocation( new ClassPathResource("myNewKeyStore.jks") );**
factory.afterPropertiesSet();
return factory.getObject();
}`
`@Bean
public Wss4jSecurityInterceptor wss4jSecurityInterceptor() throws Exception{
Wss4jSecurityInterceptor interceptor = new Wss4jSecurityInterceptor();
interceptor.setSecurementActions("UsernameToken");
interceptor.setSecurementUsername("user http");
interceptor.setSecurementPassword("pass http");
interceptor.setValidationActions("Signature");
interceptor.setValidationSignatureCrypto( myCrypto() );
interceptor.afterPropertiesSet();
return interceptor;
}`
I need to set key store from byteArray