String localName = headerElement.getLocalName();
if (log.isLoggable(Level.FINEST)) {
log.log(Level.FINEST, "EncryptionProcessor:decrypt : LocalName is "+localName);
}
if(localName == null){
context.setPVE(new PolicyViolationException(
"Expected one of EncryptedKey,EncryptedData,ReferenceList as per receiver"+
"requirements, found none"));
context.isPrimaryPolicyViolation(true);
return;
}
EncryptionPolicy inferredPolicy = null;
if(context.getMode() == FilterProcessingContext.ADHOC || context.getMode() == FilterProcessingContext.POSTHOC){
inferredPolicy = new EncryptionPolicy();
context.setInferredPolicy(inferredPolicy);
} /*else if (context.getMode() == FilterProcessingContext.WSDL_POLICY) {
inferredPolicy = new EncryptionPolicy();
context.getInferredSecurityPolicy().append(inferredPolicy);
}*/
SecretKey key =null;
if(MessageConstants.ENCRYPTED_DATA_LNAME.equals(localName)){
processEncryptedData(headerElement,key,context);
}else if(MessageConstants.XENC_ENCRYPTED_KEY_LNAME.equals(localName)){
if (context.getMode() == FilterProcessingContext.WSDL_POLICY) {
inferredPolicy = new EncryptionPolicy();
context.getInferredSecurityPolicy().append(inferredPolicy);
}
processEncryptedKey(context,headerElement);
}else if(MessageConstants.XENC_REFERENCE_LIST_LNAME.equals(localName)){
if (context.getMode() == FilterProcessingContext.WSDL_POLICY) {
inferredPolicy = new EncryptionPolicy();
context.getInferredSecurityPolicy().append(inferredPolicy);
}
decryptReferenceList(headerElement,key,null,context);
}else{
context.setPVE(new PolicyViolationException(
"Expected one of EncryptedKey,EncryptedData,ReferenceList as per receiver"+
"requirements, found "+localName));
context.isPrimaryPolicyViolation(true);
return;
}