StandaloneCrypto crypto = new StandaloneCrypto();
crypto.setKeyStoreUrl(new ClassPathResource("privatestore.jks"));
crypto.setKeyStorePassword("keyStorePassword");
WSSecurityHandler handler = new WSSecurityHandler();
handler.setAuthenticationService(new JAASAuthenticationService());
handler.setCrypto(crypto);
handler.setUsername("myalias");
crypto.setKeyPassword("myAliasPassword");
handler.setReceiveAction(WSHandlerConstants.SIGNATURE);
handler.onReceive(ctx);