use of org.apache.xml.security.binding.xmlenc.EncryptedKeyType in project santuario-java by apache.
the class AbstractDecryptInputProcessor method getSecurityToken.
private InboundSecurityToken getSecurityToken(InputProcessorChain inputProcessorChain, XMLSecStartElement xmlSecStartElement, EncryptedDataType encryptedDataType) throws XMLSecurityException {
KeyInfoType keyInfoType = this.keyInfoType;
if (keyInfoType == null) {
keyInfoType = encryptedDataType.getKeyInfo();
}
if (keyInfoType != null) {
final EncryptedKeyType encryptedKeyType = XMLSecurityUtils.getQNameType(keyInfoType.getContent(), XMLSecurityConstants.TAG_xenc_EncryptedKey);
if (encryptedKeyType != null) {
XMLEncryptedKeyInputHandler handler = new XMLEncryptedKeyInputHandler();
handler.handle(inputProcessorChain, encryptedKeyType, xmlSecStartElement, getSecurityProperties());
SecurityTokenProvider<? extends InboundSecurityToken> securityTokenProvider = inputProcessorChain.getSecurityContext().getSecurityTokenProvider(encryptedKeyType.getId());
return securityTokenProvider.getSecurityToken();
}
}
// retrieve the securityToken which must be used for decryption
return SecurityTokenFactory.getInstance().getSecurityToken(keyInfoType, SecurityTokenConstants.KeyUsage_Decryption, getSecurityProperties(), inputProcessorChain.getSecurityContext());
}
use of org.apache.xml.security.binding.xmlenc.EncryptedKeyType in project santuario-java by apache.
the class XMLEncryptedKeyInputHandler method handle.
@Override
public void handle(final InputProcessorChain inputProcessorChain, final XMLSecurityProperties securityProperties, final Deque<XMLSecEvent> eventQueue, final Integer index) throws XMLSecurityException {
@SuppressWarnings("unchecked") final EncryptedKeyType encryptedKeyType = ((JAXBElement<EncryptedKeyType>) parseStructure(eventQueue, index, securityProperties)).getValue();
final XMLSecEvent responsibleXMLSecStartXMLEvent = getResponsibleStartXMLEvent(eventQueue, index);
handle(inputProcessorChain, encryptedKeyType, responsibleXMLSecStartXMLEvent, securityProperties);
}
Aggregations