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 classAbstractDecryptInputProcessor.AbstractDecryptedEventReaderInputProcessorThe DecryptedEventReaderInputProcessor reads the decrypted stream with a StAX reader and forwards the generated XMLEvents(package private) static classAbstractDecryptInputProcessor.DecryptionThreadThe DecryptionThread handles encrypted XML-Parts
-
Field Summary
Fields Modifier and Type Field Description private KeyInfoTypekeyInfoTypeprivate static org.slf4j.LoggerLOGprotected static java.lang.IntegermaximumAllowedEncryptedDataEventsprotected static java.lang.IntegermaximumAllowedXMLStructureDepthprivate java.util.List<ReferenceType>processedReferencesprivate java.util.Map<java.lang.String,ReferenceType>referencesprivate java.util.ArrayDeque<XMLSecEvent>tmpXmlEventListprivate java.lang.Stringuuidprivate javax.xml.namespace.QNamewrapperElementName
-
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.InputStreamapplyTransforms(ReferenceType referenceType, java.io.InputStream inputStream)voiddoFinal(InputProcessorChain inputProcessorChain)Will be called when the whole document is processed.private voidforwardToWrapperElement(javax.xml.stream.XMLStreamReader xmlStreamReader)private javax.crypto.CiphergetCipher(java.lang.String algorithmURI)java.util.List<ReferenceType>getProcessedReferences()java.util.Map<java.lang.String,ReferenceType>getReferences()private InboundSecurityTokengetSecurityToken(InputProcessorChain inputProcessorChain, XMLSecStartElement xmlSecStartElement, EncryptedDataType encryptedDataType)protected abstract voidhandleCipherReference(InputProcessorChain inputProcessorChain, EncryptedDataType encryptedDataType, javax.crypto.Cipher cipher, InboundSecurityToken inboundSecurityToken)protected abstract voidhandleEncryptedContent(InputProcessorChain inputProcessorChain, XMLSecStartElement parentXMLSecStartElement, InboundSecurityToken inboundSecurityToken, EncryptedDataType encryptedDataType)protected abstract voidhandleSecurityToken(InboundSecurityToken inboundSecurityToken, InboundSecurityContext inboundSecurityContext, EncryptedDataType encryptedDataType)protected abstract java.io.InputStreamhandleXOPInclude(InputProcessorChain inputProcessorChain, EncryptedDataType encryptedDataType, java.lang.String href, javax.crypto.Cipher cipher, InboundSecurityToken inboundSecurityToken)protected ReferenceTypematchesReferenceId(XMLSecStartElement xmlSecStartElement)protected abstract AbstractDecryptInputProcessor.AbstractDecryptedEventReaderInputProcessornewDecryptedEventReaderInputProcessor(boolean encryptedHeader, XMLSecStartElement xmlSecStartElement, EncryptedDataType currentEncryptedDataType, InboundSecurityToken inboundSecurityToken, InboundSecurityContext inboundSecurityContext)private EncryptedDataTypeparseEncryptedDataStructure(boolean isSecurityHeaderEvent, XMLSecEvent xmlSecEvent, InputProcessorChain subInputProcessorChain)private XMLSecEventprocessEvent(InputProcessorChain inputProcessorChain, boolean isSecurityHeaderEvent)XMLSecEventprocessNextEvent(InputProcessorChain inputProcessorChain)Will be called from the framework when the next XMLEvent is requestedXMLSecEventprocessNextHeaderEvent(InputProcessorChain inputProcessorChain)Will be called from the framework when the next security-header XMLEvent is requestedprivate XMLSecEventreadAndBufferEncryptedHeader(InputProcessorChain inputProcessorChain, boolean isSecurityHeaderEvent, XMLSecEvent xmlSecEvent)private java.io.InputStreamwriteWrapperEndElement()private java.io.InputStreamwriteWrapperStartElement(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:InputProcessorWill be called from the framework when the next security-header XMLEvent is requested- Specified by:
processNextHeaderEventin interfaceInputProcessor- Specified by:
processNextHeaderEventin 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:InputProcessorWill be called from the framework when the next XMLEvent is requested- Specified by:
processNextEventin interfaceInputProcessor- Specified by:
processNextEventin 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.XMLStreamExceptionXMLSecurityException
-
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.XMLStreamExceptionXMLSecurityException
-
readAndBufferEncryptedHeader
private XMLSecEvent readAndBufferEncryptedHeader(InputProcessorChain inputProcessorChain, boolean isSecurityHeaderEvent, XMLSecEvent xmlSecEvent) throws javax.xml.stream.XMLStreamException, XMLSecurityException
- Throws:
javax.xml.stream.XMLStreamExceptionXMLSecurityException
-
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:InputProcessorWill be called when the whole document is processed.- Specified by:
doFinalin interfaceInputProcessor- Overrides:
doFinalin classAbstractInputProcessor- Throws:
javax.xml.stream.XMLStreamException- thrown when a streaming error occursXMLSecurityException- thrown when a Security failure occurs
-
-