private Document createSignature(Message message, Document doc)
throws Exception {
String userNameKey = SecurityConstants.SIGNATURE_USERNAME;
CryptoLoader loader = new CryptoLoader();
Crypto crypto = loader.getCrypto(message,
SecurityConstants.SIGNATURE_CRYPTO,
SecurityConstants.SIGNATURE_PROPERTIES);
if (crypto == null) {
crypto = loader.getCrypto(message,
SecurityConstants.ENCRYPT_CRYPTO,
SecurityConstants.ENCRYPT_PROPERTIES);
userNameKey = SecurityConstants.ENCRYPT_USERNAME;
}
String user = SecurityUtils.getUserName(message, crypto, userNameKey);