ArrayList<PolicyAssertion> tokenList = new ArrayList<PolicyAssertion>();
for(AssertionSet assertionSet : policy){
for(PolicyAssertion assertion:assertionSet){
if(PolicyUtil.isAsymmetricBinding(assertion, spVersion)){
AsymmetricBinding sb = (AsymmetricBinding)assertion;
Token iToken = sb.getInitiatorToken();
if (iToken != null){
addToken(iToken, tokenList);
}else{
addToken(sb.getInitiatorSignatureToken(), tokenList);
addToken(sb.getInitiatorEncryptionToken(), tokenList);
}
Token rToken = sb.getRecipientToken();
if (rToken != null){
addToken(rToken, tokenList);
}else{
addToken(sb.getRecipientSignatureToken(), tokenList);
addToken(sb.getRecipientEncryptionToken(), tokenList);
}
}else if(PolicyUtil.isSymmetricBinding(assertion, spVersion)){
SymmetricBinding sb = (SymmetricBinding)assertion;
Token token = sb.getProtectionToken();
if(token != null){
addToken(token,tokenList);
}else{
addToken(sb.getEncryptionToken(),tokenList);
addToken(sb.getSignatureToken(),tokenList);