certInfo.INCLUDE_ALWAYS_TO_RECIPIENT_VER2.equals(itVersion) ||
certInfo.INCLUDE_ALWAYS_VER2.equals(itVersion)){
certInfo.setReferenceType(MessageConstants.DIRECT_REFERENCE_TYPE);
} else if(certInfo.INCLUDE_NEVER.equals(itVersion) ||
certInfo.INCLUDE_NEVER_VER2.equals(itVersion)){
WSSAssertion wssAssertion = context.getWSSAssertion();
if(MessageConstants.DIRECT_REFERENCE_TYPE.equals(certInfo.getReferenceType())){
if(wssAssertion != null){
if (wssAssertion.getRequiredProperties().contains(WSSAssertion.MUSTSUPPORT_REF_ISSUER_SERIAL)) {
certInfo.setReferenceType(MessageConstants.X509_ISSUER_TYPE);
} else if(wssAssertion.getRequiredProperties().contains(WSSAssertion.MUSTSUPPORT_REF_THUMBPRINT)) {
certInfo.setReferenceType(MessageConstants.THUMB_PRINT_TYPE);
} else if(wssAssertion.getRequiredProperties().contains(WSSAssertion.MUST_SUPPORT_REF_KEYIDENTIFIER)) {
certInfo.setReferenceType(MessageConstants.KEY_INDETIFIER_TYPE);
}
} else {
// when wssAssertion is not set use Issuer Serial
certInfo.setReferenceType(MessageConstants.X509_ISSUER_TYPE);