public class WSSecEncrypt extends WSSecEncryptedKey
document, encryptedEphemeralKey, symmetricKey
attachmentCallbackHandler, callbackLookup, doDebug, keyIdentifierType, password, storeBytesInAttachment, user
Constructor and Description |
---|
WSSecEncrypt() |
Modifier and Type | Method and Description |
---|---|
void |
addAttachmentEncryptedDataElements(WSSecHeader secHeader) |
void |
addExternalRefElement(Element dataRef,
WSSecHeader secHeader)
Adds (prepends) the external Reference element to the Security header.
|
void |
addInternalRefElement(Element dataRef)
Adds the internal Reference element to this Encrypt data.
|
Document |
build(Document doc,
Crypto crypto,
WSSecHeader secHeader)
Builds the SOAP envelope with encrypted Body and adds encrypted key.
|
static Element |
createDataRefList(Document doc,
Element referenceList,
List<String> encDataRefs)
Create DOM subtree for
xenc:EncryptedKey |
static List<String> |
doEncryption(Document doc,
WSSecHeader securityHeader,
WsuIdAllocator idAllocator,
org.apache.xml.security.keys.KeyInfo keyInfo,
SecretKey secretKey,
String encryptionAlgorithm,
List<WSEncryptionPart> references,
CallbackLookup callbackLookup)
Perform encryption on the SOAP envelope.
|
static List<String> |
doEncryption(Document doc,
WSSecHeader securityHeader,
WsuIdAllocator idAllocator,
org.apache.xml.security.keys.KeyInfo keyInfo,
SecretKey secretKey,
String encryptionAlgorithm,
List<WSEncryptionPart> references,
CallbackLookup callbackLookup,
CallbackHandler attachmentCallbackHandler,
List<Element> attachmentEncryptedDataElements,
boolean storeBytesInAttachment) |
static List<String> |
doEncryption(Document doc,
WSSecHeader securityHeader,
WsuIdAllocator idAllocator,
org.apache.xml.security.keys.KeyInfo keyInfo,
SecretKey secretKey,
String encryptionAlgorithm,
List<WSEncryptionPart> references,
CallbackLookup callbackLookup,
CallbackHandler attachmentCallbackHandler,
List<Element> attachmentEncryptedDataElements,
boolean storeBytesInAttachment,
org.apache.xml.security.encryption.Serializer encryptionSerializer) |
Element |
encrypt() |
Element |
encrypt(WSSecHeader secHeader) |
Element |
encryptForRef(Element dataRef,
List<WSEncryptionPart> references) |
Element |
encryptForRef(Element dataRef,
List<WSEncryptionPart> references,
WSSecHeader secHeader)
Encrypt one or more parts or elements of the message.
|
List<Element> |
getAttachmentEncryptedDataElements() |
org.apache.xml.security.encryption.Serializer |
getEncryptionSerializer() |
SecurityTokenReference |
getSecurityTokenReference() |
boolean |
isEmbedEncryptedKey() |
boolean |
isEncryptSymmKey() |
void |
prepare(Document doc,
Crypto crypto)
Initialize a WSSec Encrypt.
|
void |
setCustomReferenceValue(String customReferenceValue) |
void |
setEmbedEncryptedKey(boolean embedEncryptedKey) |
void |
setEncKeyIdDirectId(boolean b) |
void |
setEncryptionSerializer(org.apache.xml.security.encryption.Serializer encryptionSerializer) |
void |
setEncryptSymmKey(boolean encryptSymmKey) |
void |
setSecurityTokenReference(SecurityTokenReference reference) |
appendBSTElementToHeader, appendToHeader, clean, createCipherValue, createEncryptedKey, getBinarySecurityTokenElement, getBSTTokenId, getCustomEKKeyInfoElement, getDigestAlgorithm, getEncryptedEphemeralKey, getEncryptedKeyElement, getEphemeralKey, getId, getKeyEncAlgo, getMGFAlgorithm, getSymmetricEncAlgorithm, getSymmetricKey, getUseThisCert, getUseThisPublicKey, isCertSet, isIncludeEncryptionToken, prepareInternal, prepareInternal, prepareInternal, prependBSTElementToHeader, prependToHeader, setCustomEKKeyInfoElement, setCustomEKTokenId, setCustomEKTokenValueType, setDigestAlgorithm, setDocument, setEncKeyId, setEncryptedEphemeralKey, setEncryptedKeyElement, setEphemeralKey, setIncludeEncryptionToken, setKeyEncAlgo, setMGFAlgorithm, setSymmetricEncAlgorithm, setSymmetricKey, setUserInfo, setUseThisCert, setUseThisPublicKey
getIdAllocator, getKeyIdentifierType, getParts, setAttachmentCallbackHandler, setBodyID, setCallbackLookup, setIdAllocator, setKeyIdentifierType, setStoreBytesInAttachment, setUserInfo, setWsuId
public void prepare(Document doc, Crypto crypto) throws WSSecurityException
prepare
in class WSSecEncryptedKey
doc
- The SOAP envelope as Document
crypto
- An instance of the Crypto API to handle keystore and certificatesWSSecurityException
public Document build(Document doc, Crypto crypto, WSSecHeader secHeader) throws WSSecurityException
doc
- the SOAP envelope as Document
with plain text Bodycrypto
- an instance of the Crypto API to handle keystore and CertificatessecHeader
- the security header element to hold the encrypted key element.Document
WSSecurityException
public Element encrypt() throws WSSecurityException
WSSecurityException
public Element encrypt(WSSecHeader secHeader) throws WSSecurityException
WSSecurityException
public Element encryptForRef(Element dataRef, List<WSEncryptionPart> references) throws WSSecurityException
WSSecurityException
public Element encryptForRef(Element dataRef, List<WSEncryptionPart> references, WSSecHeader secHeader) throws WSSecurityException
WSEncryptionPart
object that
contain information about the elements to encrypt. The method call the
encryption method, takes the reference information generated during
encryption and add this to the xenc:Reference
element.
This method can be called after prepare()
and can be
called multiple times to encrypt a number of parts or elements.
The method generates a xenc:Reference
element that must
be added to this token. See addInternalRefElement()
.
If the dataRef
parameter is null
the method
creates and initializes a new Reference element.dataRef
- A xenc:Reference
element or null
references
- A list containing WSEncryptionPart objectssecHeader
- The WSSecHeader instancexenc:Reference
elementWSSecurityException
public void addInternalRefElement(Element dataRef)
encryptForInternalRef()
method. The reference element is
added to the EncryptedKey
element of this encrypt block.dataRef
- The internal enc:Reference
elementpublic void addExternalRefElement(Element dataRef, WSSecHeader secHeader)
encryptForExternalRef()
method. The method prepends the
reference element in the SecurityHeader.dataRef
- The external enc:Reference
elementsecHeader
- The security header.public void addAttachmentEncryptedDataElements(WSSecHeader secHeader)
public static List<String> doEncryption(Document doc, WSSecHeader securityHeader, WsuIdAllocator idAllocator, org.apache.xml.security.keys.KeyInfo keyInfo, SecretKey secretKey, String encryptionAlgorithm, List<WSEncryptionPart> references, CallbackLookup callbackLookup) throws WSSecurityException
doc
- The document containing the SOAP envelope as document elementidAllocator
- A WsuIdAllocator used to generate wsu:ID'skeyInfo
- The KeyInfo object to set in EncryptedDatasecretKey
- The SecretKey object with which to encrypt dataencryptionAlgorithm
- The encryption algorithm URI to usereferences
- The list of references to encryptWSSecurityException
public static List<String> doEncryption(Document doc, WSSecHeader securityHeader, WsuIdAllocator idAllocator, org.apache.xml.security.keys.KeyInfo keyInfo, SecretKey secretKey, String encryptionAlgorithm, List<WSEncryptionPart> references, CallbackLookup callbackLookup, CallbackHandler attachmentCallbackHandler, List<Element> attachmentEncryptedDataElements, boolean storeBytesInAttachment) throws WSSecurityException
WSSecurityException
public static List<String> doEncryption(Document doc, WSSecHeader securityHeader, WsuIdAllocator idAllocator, org.apache.xml.security.keys.KeyInfo keyInfo, SecretKey secretKey, String encryptionAlgorithm, List<WSEncryptionPart> references, CallbackLookup callbackLookup, CallbackHandler attachmentCallbackHandler, List<Element> attachmentEncryptedDataElements, boolean storeBytesInAttachment, org.apache.xml.security.encryption.Serializer encryptionSerializer) throws WSSecurityException
WSSecurityException
public static Element createDataRefList(Document doc, Element referenceList, List<String> encDataRefs)
xenc:EncryptedKey
doc
- the SOAP envelope parent documentreferenceList
- encDataRefs
- xenc:EncryptedKey
elementpublic SecurityTokenReference getSecurityTokenReference()
public void setSecurityTokenReference(SecurityTokenReference reference)
reference
- public boolean isEncryptSymmKey()
public void setEncryptSymmKey(boolean encryptSymmKey)
public void setCustomReferenceValue(String customReferenceValue)
public void setEncKeyIdDirectId(boolean b)
public void setEmbedEncryptedKey(boolean embedEncryptedKey)
public boolean isEmbedEncryptedKey()
public org.apache.xml.security.encryption.Serializer getEncryptionSerializer()
public void setEncryptionSerializer(org.apache.xml.security.encryption.Serializer encryptionSerializer)
Copyright © 2017 JBoss by Red Hat. All rights reserved.