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,
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,
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) |
Element |
encrypt() |
Element |
encryptForRef(Element dataRef,
List<WSEncryptionPart> references)
Encrypt one or more parts or elements of the message.
|
List<Element> |
getAttachmentEncryptedDataElements() |
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 |
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, isCertSet, isIncludeEncryptionToken, prepareInternal, prepareInternal, prependBSTElementToHeader, prependToHeader, setCustomEKKeyInfoElement, setCustomEKTokenId, setCustomEKTokenValueType, setDigestAlgorithm, setDocument, setEncKeyId, setEncryptedEphemeralKey, setEncryptedKeyElement, setEphemeralKey, setIncludeEncryptionToken, setKeyEncAlgo, setMGFAlgorithm, setSymmetricEncAlgorithm, setSymmetricKey, setUserInfo, setUseThisCert
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 encryptForRef(Element dataRef, List<WSEncryptionPart> references) 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 objectsxenc: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, 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, 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 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()
Copyright © 2016 JBoss by Red Hat. All rights reserved.