Collection<AssertionInfo> ais = aim.get(SP12Constants.ASYMMETRIC_BINDING);
if (ais == null) {
return true;
}
for (AssertionInfo ai : ais) {
AsymmetricBinding abinding = (AsymmetricBinding)ai.getAssertion();
ai.setAsserted(true);
if (abinding.getProtectionOrder() == SPConstants.ProtectionOrder.EncryptBeforeSigning) {
if (abinding.isSignatureProtection()) {
if (prots == Protections.ENCRYPT_SIGN
|| prots == Protections.SIGN_ENCRYPT) {
ai.setNotAsserted("Not encrypted before signed and then protected");
return false;
}
} else if (prots == Protections.SIGN_ENCRYPT) {
ai.setNotAsserted("Not encrypted before signed");
return false;
}
} else if (prots == Protections.ENCRYPT_SIGN) {
ai.setNotAsserted("Not signed before encrypted");
return false;
}
AlgorithmSuitePolicyValidator algorithmValidator = new AlgorithmSuitePolicyValidator(results);
if (!algorithmValidator.validatePolicy(ai, abinding.getAlgorithmSuite())) {
return false;
}
if (abinding.getInitiatorToken() != null) {
assertPolicy(aim, abinding.getInitiatorToken());
assertPolicy(aim, abinding.getInitiatorToken().getToken(), derived);
}
if (abinding.getRecipientToken() != null) {
assertPolicy(aim, abinding.getRecipientToken());
assertPolicy(aim, abinding.getRecipientToken().getToken(), derived);
}
}
return true;
}