title: Spring WSS4J The private key for the supplied alias does not exist in the keystore
body: <p>I'm using Spring + wss4j with annotations config. The <code>Wss4jSecurityInterceptor</code> interceptor has this configuration:</p>
  
  <pre><code>@Bean
  public Wss4jSecurityInterceptor sessionInterceptorNb() throws Exception {
      Wss4jSecurityInterceptor securityInterceptor = new Wss4jSecurityInterceptor();
  
      // set security actions
      securityInterceptor.setSecurementActions("UsernameToken Signature Encrypt");
  
      // sign the request
      securityInterceptor.setSecurementUsername("anyuser");
      securityInterceptor.setSecurementPassword("anypassword");
  
      securityInterceptor.setSecurementSignatureUser("privatecertuser");
      securityInterceptor.setSecurementSignatureCrypto(getCryptoFactoryBeanNb().getObject());
      securityInterceptor.setSecurementSignatureParts("{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body");
  
      return securityInterceptor;
  }
  </code></pre>
  
  <p>That's all.
   I want to set anyuser and anypassword to the request element <code>UsernameToken</code> and use the privatecertuser to sign the request, but I'm geeting this error:</p>
  
  <pre><code>    Original Exception was java.security.UnrecoverableKeyException: Cannot recover key
  
  Caused by: org.apache.wss4j.common.ext.WSSecurityException: Error during Signature: 
      at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:163)
      at org.apache.wss4j.dom.handler.WSHandler.doSenderAction(WSHandler.java:238)
      at org.springframework.ws.soap.security.wss4j2.Wss4jHandler.doSenderAction(Wss4jHandler.java:63)
      at org.springframework.ws.soap.security.wss4j2.Wss4jSecurityInterceptor.secureMessage(Wss4jSecurityInterceptor.java:574)
      ... 45 common frames omitted
  Caused by: org.apache.wss4j.common.ext.WSSecurityException: The private key for the supplied alias does not exist in the keystore
      at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:595)
      at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:155)
      ... 48 common frames omitted
  </code></pre>
  
  <p>I'm using the command <code>keytool -list -v -keystore</code> to see the content of the keystore and I can see the private entry for the "privatecertuser".</p>
  
  <p>If I delete the method call to </p>
  
  <pre><code>securityInterceptor.setSecurementSignatureUser("privatecertuser");
  </code></pre>
  
  <p>and set this value in the method <code>setSecurementUsername</code> works fine.</p>
  
  <p>What can be wrong in the condiguration?</p>