Olá pessoal. Preciso consumir um webservice, mas a informação que vem dele está criptografada e eu já não sei mais o que fazer. Utilizo o Wss4jSecurityInterceptor para preparar o cabeçalho. Conforme código abaixo:
Wss4jSecurityInterceptor wss4jSecurityInterceptor = new Wss4jSecurityInterceptor();
wss4jSecurityInterceptor.setSecurementActions("UsernameToken Timestamp Signature Encrypt");
// UsernameToken
wss4jSecurityInterceptor.setSecurementUsername("78742");
wss4jSecurityInterceptor.setSecurementPassword(trustStorePassword);
wss4jSecurityInterceptor.setSecurementPasswordType(WSConstants.PW_DIGEST);
wss4jSecurityInterceptor.setSecurementUsernameTokenNonce(true);
// Timestamp
wss4jSecurityInterceptor.setFutureTimeToLive(60);
wss4jSecurityInterceptor.setTimestampPrecisionInMilliseconds(true);
// Signature
CryptoFactoryBean outCryptoFactoryBean = new CryptoFactoryBean();
outCryptoFactoryBean.setCryptoProvider(Merlin.class);
outCryptoFactoryBean.setKeyStoreType("jks");
outCryptoFactoryBean.setDefaultX509Alias("clientkey");
outCryptoFactoryBean.setKeyStorePassword(trustStorePassword);
outCryptoFactoryBean.setKeyStoreLocation(trustStore);
outCryptoFactoryBean.afterPropertiesSet();
wss4jSecurityInterceptor.setSecurementSignatureUser("clientkey");
wss4jSecurityInterceptor.setSecurementSignatureCrypto(outCryptoFactoryBean.getObject());
wss4jSecurityInterceptor.setSecurementSignatureKeyIdentifier("DirectReference");
// Encrypt
wss4jSecurityInterceptor.setSecurementEncryptionCrypto(outCryptoFactoryBean.getObject());
wss4jSecurityInterceptor.setSecurementEncryptionUser("serverkey");
Como eu faço para DESCIFRAR o body do retorno?