|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.wss4j.dom.message.WSSecBase
org.apache.wss4j.dom.message.WSSecEncryptedKey
org.apache.wss4j.dom.message.WSSecEncrypt
public class WSSecEncrypt
Encrypts a parts of a message according to WS Specification, X509 profile, and adds the encryption data.
| Field Summary |
|---|
| Fields inherited from class org.apache.wss4j.dom.message.WSSecEncryptedKey |
|---|
bstToken, document, encKeyId, encryptedEphemeralKey, encryptedKeyElement, envelope, ephemeralKey, keyEncAlgo, symEncAlgo, symmetricKey, useThisCert |
| Fields inherited from class org.apache.wss4j.dom.message.WSSecBase |
|---|
attachmentCallbackHandler, callbackLookup, doDebug, keyIdentifierType, parts, password, user |
| Constructor Summary | |
|---|---|
WSSecEncrypt()
|
|
WSSecEncrypt(WSSConfig config)
|
|
| Method Summary | |
|---|---|
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,
WSSConfig config,
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,
WSSConfig config,
org.apache.xml.security.keys.KeyInfo keyInfo,
SecretKey secretKey,
String encryptionAlgorithm,
List<WSEncryptionPart> references,
CallbackLookup callbackLookup,
CallbackHandler attachmentCallbackHandler,
List<Element> attachmentEncryptedDataElements)
|
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 |
setKeyEnc(String keyEnc)
Sets the algorithm to encode the symmetric key. |
void |
setSecurityTokenReference(SecurityTokenReference reference)
|
| Methods inherited from class org.apache.wss4j.dom.message.WSSecBase |
|---|
getKeyIdentifierType, getWsConfig, setAttachmentCallbackHandler, setBodyID, setCallbackLookup, setKeyIdentifierType, setParts, setUserInfo, setWsConfig, setWsuId |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public WSSecEncrypt()
public WSSecEncrypt(WSSConfig config)
| Method Detail |
|---|
public void setKeyEnc(String keyEnc)
WSConstants.KEYTRANSPORT_RSAOEP algorithm.
keyEnc - specifies the key encoding algorithm.WSConstants.KEYTRANSPORT_RSA15,
WSConstants.KEYTRANSPORT_RSAOEP
public void prepare(Document doc,
Crypto crypto)
throws WSSecurityException
prepare in class WSSecEncryptedKeydoc - The SOAP envelope as Documentcrypto - An instance of the Crypto API to handle keystore and certificates
WSSecurityException
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 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 nullreferences - A list containing WSEncryptionPart objects
xenc:Reference element
WSSecurityExceptionpublic void addInternalRefElement(Element dataRef)
encryptForInternalRef() method. The reference element is
added to the EncryptedKey element of this encrypt block.
dataRef - The internal enc:Reference element
public 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,
WSSConfig config,
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 elementconfig - The WSSConfig from which 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 encrypt
WSSecurityException
public static List<String> doEncryption(Document doc,
WSSConfig config,
org.apache.xml.security.keys.KeyInfo keyInfo,
SecretKey secretKey,
String encryptionAlgorithm,
List<WSEncryptionPart> references,
CallbackLookup callbackLookup,
CallbackHandler attachmentCallbackHandler,
List<Element> attachmentEncryptedDataElements)
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 List<Element> getAttachmentEncryptedDataElements()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||