wsSign.setUseDirectReferenceToAssertion(true);
wsSign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
Document doc = SOAPUtil.toSOAPPart(SOAPUtil.SAMPLE_SOAP_MSG);
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Crypto userCrypto = CryptoFactory.getInstance("transmitter-crypto.properties");
Document securedDocument = wsSign.build(doc, userCrypto, samlAssertion, null, null, null, secHeader);
//some test that we can really sure we get what we want from WSS4J