if (binding instanceof SymmetricBinding && !endorse) {
encryptCrypto = ((SymmetricBinding)binding).getProtectionToken() != null;
userNameKey = SecurityConstants.ENCRYPT_USERNAME;
}
Crypto crypto = encryptCrypto ? getEncryptionCrypto(wrapper)
: getSignatureCrypto(wrapper);
if (endorse && crypto == null && binding instanceof SymmetricBinding) {
userNameKey = SecurityConstants.ENCRYPT_USERNAME;
crypto = getEncryptionCrypto(wrapper);
}
if (!endorse) {
message.getExchange().put(SecurityConstants.SIGNATURE_CRYPTO, crypto);
}
String user = (String)message.getContextualProperty(userNameKey);
if (crypto != null) {
if (StringUtils.isEmpty(user)) {
user = crypto.getDefaultX509Alias();
}
if (user == null) {
try {
Enumeration<String> en = crypto.getKeyStore().aliases();
if (en.hasMoreElements()) {
user = en.nextElement();
}
if (en.hasMoreElements()) {
//more than one alias in the keystore, user WILL need