|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.apache.ws.security.message.WSBaseMessage
org.apache.ws.security.message.WSEncryptBody
Encrypts a SOAP body inside a SOAP envelope according to WS Specification, X509 profile, and adds the encryption data.
| Field Summary | |
protected byte[] |
embeddedKey
|
protected java.lang.String |
embeddedKeyName
|
protected java.lang.String |
encCanonAlgo
|
protected javax.crypto.SecretKey |
encryptionKey
Symmetric key that's actually used. |
protected java.lang.String |
keyEncAlgo
|
protected org.w3c.dom.Element |
parentNode
Parent node to which the EncryptedKeyElement should be added. |
protected SecurityTokenReference |
securityTokenReference
SecurityTokenReference to be inserted into EncryptedData/keyInfo element. |
protected java.lang.String |
symEncAlgo
|
protected javax.crypto.SecretKey |
symmetricKey
Symmetric key used in the EncrytpedKey. |
protected java.security.cert.X509Certificate |
useThisCert
|
| Fields inherited from class org.apache.ws.security.message.WSBaseMessage |
actor, doDebug, keyIdentifierType, mustunderstand, parts, password, timeToLive, user, wssConfig |
| Constructor Summary | |
WSEncryptBody()
Constructor. |
|
WSEncryptBody(java.lang.String actor)
Constructor. |
|
WSEncryptBody(java.lang.String actor,
boolean mu)
Constructor. |
|
| Method Summary | |
org.w3c.dom.Document |
build(org.w3c.dom.Document doc,
Crypto crypto)
Builds the SOAP envelope with encrypted Body and adds encrypted key. |
static org.w3c.dom.Element |
createCipherValue(org.w3c.dom.Document doc,
org.w3c.dom.Element encryptedKey)
|
static org.w3c.dom.Element |
createDataRefList(org.w3c.dom.Document doc,
org.w3c.dom.Element encryptedKey,
java.util.Vector encDataRefs)
|
static org.w3c.dom.Element |
createEnrcyptedKey(org.w3c.dom.Document doc,
java.lang.String keyTransportAlgo)
Create DOM subtree for xenc:EncryptedKey |
javax.crypto.SecretKey |
getEncryptionKey()
Get the symmetric key used for encryption. |
SecurityTokenReference |
getSecurityTokenReference()
|
java.lang.String |
getSymmetricEncAlgorithm()
Get the name of symmetric encryption algorithm to use. |
javax.crypto.SecretKey |
getSymmetricKey()
|
void |
setEmbeddedKeyName(java.lang.String embeddedKeyName)
Set the key name for EMBEDDED_KEYNAME |
void |
setEncCanonicalization(java.lang.String algo)
Set the name of an optional canonicalization algorithm to use before encryption. |
void |
setKey(byte[] key)
Sets the key to use during embedded encryption. |
void |
setKeyEnc(java.lang.String keyEnc)
Sets the algorithm to encode the symmetric key. |
void |
setParentNode(org.w3c.dom.Element element)
Sets the parent node of the EncryptedKeyElement |
void |
setSecurityTokenReference(SecurityTokenReference reference)
|
void |
setSymmetricEncAlgorithm(java.lang.String algo)
Set the name of the symmetric encryption algorithm to use. |
void |
setSymmetricKey(javax.crypto.SecretKey key)
Set the symmetric key to be used for encryption |
void |
setUserInfo(java.lang.String user)
Set the user name to get the encryption certificate. |
void |
setUseThisCert(java.security.cert.X509Certificate cert)
Set the X509 Certificate to use for encryption. |
| Methods inherited from class org.apache.ws.security.message.WSBaseMessage |
getKeyIdentifierType, insertSecurityHeader, setActor, setBodyID, setKeyIdentifierType, setMustUnderstand, setParts, setTimeToLive, setUserInfo, setWsConfig, setWsuId |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String symEncAlgo
protected java.lang.String keyEncAlgo
protected java.lang.String encCanonAlgo
protected byte[] embeddedKey
protected java.lang.String embeddedKeyName
protected java.security.cert.X509Certificate useThisCert
protected javax.crypto.SecretKey symmetricKey
protected javax.crypto.SecretKey encryptionKey
protected org.w3c.dom.Element parentNode
protected SecurityTokenReference securityTokenReference
| Constructor Detail |
public WSEncryptBody()
public WSEncryptBody(java.lang.String actor)
actor - The actor name of the wsse:Security
header
public WSEncryptBody(java.lang.String actor,
boolean mu)
actor - The actor name of the wsse:Security headermu - Set mustUnderstand to true or false| Method Detail |
public void setKey(byte[] key)
key - to use during encryption. The key must fit the
selected symmetrical encryption algorithmpublic void setKeyEnc(java.lang.String keyEnc)
WSConstants.KEYTRANSPORT_RSA15
algorithm.
keyEnc - specifies the key encoding algorithm.WSConstants.KEYTRANSPORT_RSA15,
WSConstants.KEYTRANSPORT_RSAOEPpublic void setUserInfo(java.lang.String user)
user - public void setEmbeddedKeyName(java.lang.String embeddedKeyName)
embeddedKeyName - public void setUseThisCert(java.security.cert.X509Certificate cert)
DirectReference then use this certificate
to get the public key for encryption.
cert - is the X509 certificate to use for encryptionpublic void setSymmetricEncAlgorithm(java.lang.String algo)
algo - Is the name of the encryption algorithmWSConstants.TRIPLE_DES,
WSConstants.AES_128,
WSConstants.AES_192,
WSConstants.AES_256public void setEncCanonicalization(java.lang.String algo)
algo - Is the name of the canonicalization algorithmpublic java.lang.String getSymmetricEncAlgorithm()
WSConstants.TRIPLE_DES,
WSConstants.AES_128,
WSConstants.AES_192,
WSConstants.AES_256
public org.w3c.dom.Document build(org.w3c.dom.Document doc,
Crypto crypto)
throws WSSecurityException
xenc:EncryptedData
wsse:Security header block
doc - the SOAP envelope as Document with
plaintext Bodycrypto - an instance of the Crypto API to handle keystore and
Certificates
Document
WSSecurityException
public static org.w3c.dom.Element createEnrcyptedKey(org.w3c.dom.Document doc,
java.lang.String keyTransportAlgo)
xenc:EncryptedKey
doc - the SOAP enevelope parent documentkeyTransportAlgo - specifies which alogrithm to use to encrypt the symmetric key
xenc:EncryptedKey element
public static org.w3c.dom.Element createCipherValue(org.w3c.dom.Document doc,
org.w3c.dom.Element encryptedKey)
public static org.w3c.dom.Element createDataRefList(org.w3c.dom.Document doc,
org.w3c.dom.Element encryptedKey,
java.util.Vector encDataRefs)
public void setParentNode(org.w3c.dom.Element element)
element - public javax.crypto.SecretKey getSymmetricKey()
public void setSymmetricKey(javax.crypto.SecretKey key)
key - public javax.crypto.SecretKey getEncryptionKey()
public SecurityTokenReference getSecurityTokenReference()
public void setSecurityTokenReference(SecurityTokenReference reference)
reference -
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||