Class AbstractDecryptInputProcessor
- java.lang.Object
-
- org.apache.xml.security.stax.ext.AbstractInputProcessor
-
- org.apache.xml.security.stax.impl.processor.input.AbstractDecryptInputProcessor
-
- All Implemented Interfaces:
InputProcessor
- Direct Known Subclasses:
XMLDecryptInputProcessor
public abstract class AbstractDecryptInputProcessor extends AbstractInputProcessor
Processor for decryption of EncryptedData XML structures
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AbstractDecryptInputProcessor.AbstractDecryptedEventReaderInputProcessor
The DecryptedEventReaderInputProcessor reads the decrypted stream with a StAX reader and forwards the generated XMLEvents(package private) static class
AbstractDecryptInputProcessor.DecryptionThread
The DecryptionThread handles encrypted XML-Parts
-
Field Summary
Fields Modifier and Type Field Description private KeyInfoType
keyInfoType
private static org.slf4j.Logger
LOG
protected static java.lang.Integer
maximumAllowedEncryptedDataEvents
protected static java.lang.Integer
maximumAllowedXMLStructureDepth
private java.util.List<ReferenceType>
processedReferences
private java.util.Map<java.lang.String,ReferenceType>
references
private java.util.ArrayDeque<XMLSecEvent>
tmpXmlEventList
private java.lang.String
uuid
private javax.xml.namespace.QName
wrapperElementName
-
Constructor Summary
Constructors Constructor Description AbstractDecryptInputProcessor(KeyInfoType keyInfoType, ReferenceList referenceList, XMLSecurityProperties securityProperties)
AbstractDecryptInputProcessor(XMLSecurityProperties securityProperties)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.io.InputStream
applyTransforms(ReferenceType referenceType, java.io.InputStream inputStream)
void
doFinal(InputProcessorChain inputProcessorChain)
Will be called when the whole document is processed.private void
forwardToWrapperElement(javax.xml.stream.XMLStreamReader xmlStreamReader)
private javax.crypto.Cipher
getCipher(java.lang.String algorithmURI)
java.util.List<ReferenceType>
getProcessedReferences()
java.util.Map<java.lang.String,ReferenceType>
getReferences()
private InboundSecurityToken
getSecurityToken(InputProcessorChain inputProcessorChain, XMLSecStartElement xmlSecStartElement, EncryptedDataType encryptedDataType)
protected abstract void
handleCipherReference(InputProcessorChain inputProcessorChain, EncryptedDataType encryptedDataType, javax.crypto.Cipher cipher, InboundSecurityToken inboundSecurityToken)
protected abstract void
handleEncryptedContent(InputProcessorChain inputProcessorChain, XMLSecStartElement parentXMLSecStartElement, InboundSecurityToken inboundSecurityToken, EncryptedDataType encryptedDataType)
protected abstract void
handleSecurityToken(InboundSecurityToken inboundSecurityToken, InboundSecurityContext inboundSecurityContext, EncryptedDataType encryptedDataType)
protected abstract java.io.InputStream
handleXOPInclude(InputProcessorChain inputProcessorChain, EncryptedDataType encryptedDataType, java.lang.String href, javax.crypto.Cipher cipher, InboundSecurityToken inboundSecurityToken)
protected ReferenceType
matchesReferenceId(XMLSecStartElement xmlSecStartElement)
protected abstract AbstractDecryptInputProcessor.AbstractDecryptedEventReaderInputProcessor
newDecryptedEventReaderInputProcessor(boolean encryptedHeader, XMLSecStartElement xmlSecStartElement, EncryptedDataType currentEncryptedDataType, InboundSecurityToken inboundSecurityToken, InboundSecurityContext inboundSecurityContext)
private EncryptedDataType
parseEncryptedDataStructure(boolean isSecurityHeaderEvent, XMLSecEvent xmlSecEvent, InputProcessorChain subInputProcessorChain)
private XMLSecEvent
processEvent(InputProcessorChain inputProcessorChain, boolean isSecurityHeaderEvent)
XMLSecEvent
processNextEvent(InputProcessorChain inputProcessorChain)
Will be called from the framework when the next XMLEvent is requestedXMLSecEvent
processNextHeaderEvent(InputProcessorChain inputProcessorChain)
Will be called from the framework when the next security-header XMLEvent is requestedprivate XMLSecEvent
readAndBufferEncryptedHeader(InputProcessorChain inputProcessorChain, boolean isSecurityHeaderEvent, XMLSecEvent xmlSecEvent)
private java.io.InputStream
writeWrapperEndElement()
private java.io.InputStream
writeWrapperStartElement(XMLSecStartElement xmlSecStartElement)
-
Methods inherited from class org.apache.xml.security.stax.ext.AbstractInputProcessor
addAfterProcessor, addBeforeProcessor, getAfterProcessors, getBeforeProcessors, getPhase, getReferenceIDAttribute, getSecurityProperties, setPhase
-
-
-
-
Field Detail
-
LOG
private static final transient org.slf4j.Logger LOG
-
maximumAllowedXMLStructureDepth
protected static final java.lang.Integer maximumAllowedXMLStructureDepth
-
maximumAllowedEncryptedDataEvents
protected static final java.lang.Integer maximumAllowedEncryptedDataEvents
-
keyInfoType
private final KeyInfoType keyInfoType
-
references
private final java.util.Map<java.lang.String,ReferenceType> references
-
processedReferences
private final java.util.List<ReferenceType> processedReferences
-
uuid
private final java.lang.String uuid
-
wrapperElementName
private final javax.xml.namespace.QName wrapperElementName
-
tmpXmlEventList
private final java.util.ArrayDeque<XMLSecEvent> tmpXmlEventList
-
-
Constructor Detail
-
AbstractDecryptInputProcessor
public AbstractDecryptInputProcessor(XMLSecurityProperties securityProperties) throws XMLSecurityException
- Throws:
XMLSecurityException
-
AbstractDecryptInputProcessor
public AbstractDecryptInputProcessor(KeyInfoType keyInfoType, ReferenceList referenceList, XMLSecurityProperties securityProperties) throws XMLSecurityException
- Throws:
XMLSecurityException
-
-
Method Detail
-
getReferences
public java.util.Map<java.lang.String,ReferenceType> getReferences()
-
getProcessedReferences
public java.util.List<ReferenceType> getProcessedReferences()
-
processNextHeaderEvent
public XMLSecEvent processNextHeaderEvent(InputProcessorChain inputProcessorChain) throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessor
Will be called from the framework when the next security-header XMLEvent is requested- Specified by:
processNextHeaderEvent
in interfaceInputProcessor
- Specified by:
processNextHeaderEvent
in classAbstractInputProcessor
- Returns:
- The next XMLSecEvent
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
processNextEvent
public XMLSecEvent processNextEvent(InputProcessorChain inputProcessorChain) throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessor
Will be called from the framework when the next XMLEvent is requested- Specified by:
processNextEvent
in interfaceInputProcessor
- Specified by:
processNextEvent
in classAbstractInputProcessor
- Returns:
- The next XMLSecEvent
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
processEvent
private XMLSecEvent processEvent(InputProcessorChain inputProcessorChain, boolean isSecurityHeaderEvent) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
applyTransforms
protected java.io.InputStream applyTransforms(ReferenceType referenceType, java.io.InputStream inputStream) throws XMLSecurityException
- Throws:
XMLSecurityException
-
writeWrapperStartElement
private java.io.InputStream writeWrapperStartElement(XMLSecStartElement xmlSecStartElement) throws java.io.IOException
- Throws:
java.io.IOException
-
writeWrapperEndElement
private java.io.InputStream writeWrapperEndElement() throws java.io.IOException
- Throws:
java.io.IOException
-
forwardToWrapperElement
private void forwardToWrapperElement(javax.xml.stream.XMLStreamReader xmlStreamReader) throws javax.xml.stream.XMLStreamException
- Throws:
javax.xml.stream.XMLStreamException
-
getCipher
private javax.crypto.Cipher getCipher(java.lang.String algorithmURI) throws XMLSecurityException
- Throws:
XMLSecurityException
-
getSecurityToken
private InboundSecurityToken getSecurityToken(InputProcessorChain inputProcessorChain, XMLSecStartElement xmlSecStartElement, EncryptedDataType encryptedDataType) throws XMLSecurityException
- Throws:
XMLSecurityException
-
parseEncryptedDataStructure
private EncryptedDataType parseEncryptedDataStructure(boolean isSecurityHeaderEvent, XMLSecEvent xmlSecEvent, InputProcessorChain subInputProcessorChain) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
readAndBufferEncryptedHeader
private XMLSecEvent readAndBufferEncryptedHeader(InputProcessorChain inputProcessorChain, boolean isSecurityHeaderEvent, XMLSecEvent xmlSecEvent) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamException
XMLSecurityException
-
newDecryptedEventReaderInputProcessor
protected abstract AbstractDecryptInputProcessor.AbstractDecryptedEventReaderInputProcessor newDecryptedEventReaderInputProcessor(boolean encryptedHeader, XMLSecStartElement xmlSecStartElement, EncryptedDataType currentEncryptedDataType, InboundSecurityToken inboundSecurityToken, InboundSecurityContext inboundSecurityContext) throws XMLSecurityException
- Throws:
XMLSecurityException
-
handleSecurityToken
protected abstract void handleSecurityToken(InboundSecurityToken inboundSecurityToken, InboundSecurityContext inboundSecurityContext, EncryptedDataType encryptedDataType) throws XMLSecurityException
- Throws:
XMLSecurityException
-
handleEncryptedContent
protected abstract void handleEncryptedContent(InputProcessorChain inputProcessorChain, XMLSecStartElement parentXMLSecStartElement, InboundSecurityToken inboundSecurityToken, EncryptedDataType encryptedDataType) throws XMLSecurityException
- Throws:
XMLSecurityException
-
handleCipherReference
protected abstract void handleCipherReference(InputProcessorChain inputProcessorChain, EncryptedDataType encryptedDataType, javax.crypto.Cipher cipher, InboundSecurityToken inboundSecurityToken) throws XMLSecurityException
- Throws:
XMLSecurityException
-
handleXOPInclude
protected abstract java.io.InputStream handleXOPInclude(InputProcessorChain inputProcessorChain, EncryptedDataType encryptedDataType, java.lang.String href, javax.crypto.Cipher cipher, InboundSecurityToken inboundSecurityToken) throws XMLSecurityException
- Throws:
XMLSecurityException
-
matchesReferenceId
protected ReferenceType matchesReferenceId(XMLSecStartElement xmlSecStartElement)
-
doFinal
public void doFinal(InputProcessorChain inputProcessorChain) throws javax.xml.stream.XMLStreamException, XMLSecurityException
Description copied from interface:InputProcessor
Will be called when the whole document is processed.- Specified by:
doFinal
in interfaceInputProcessor
- Overrides:
doFinal
in classAbstractInputProcessor
- Throws:
javax.xml.stream.XMLStreamException
- thrown when a streaming error occursXMLSecurityException
- thrown when a Security failure occurs
-
-