|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.ws.security.message.WSSecBase
org.apache.ws.security.message.WSSecEncryptedKey
org.apache.ws.security.message.WSSecEncrypt
Encrypts a parts of a message 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 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. |
Fields inherited from class org.apache.ws.security.message.WSSecEncryptedKey |
bstToken, document, encKeyId, encrUser, encryptedKeyElement, envelope, ephemeralKey, keyEncAlgo, useThisCert |
Fields inherited from class org.apache.ws.security.message.WSSecBase |
doDebug, keyIdentifierType, parts, password, user, wssConfig |
Constructor Summary | |
WSSecEncrypt()
Constructor. |
Method Summary | |
void |
addExternalRefElement(org.w3c.dom.Element dataRef,
WSSecHeader secHeader)
Adds (prepends) the external Reference element to the Security header. |
void |
addInternalRefElement(org.w3c.dom.Element dataRef)
Adds the internal Reference element to this Encrypt data. |
org.w3c.dom.Document |
build(org.w3c.dom.Document doc,
Crypto crypto,
WSSecHeader secHeader)
Builds the SOAP envelope with encrypted Body and adds encrypted key. |
static org.w3c.dom.Element |
createDataRefList(org.w3c.dom.Document doc,
org.w3c.dom.Element referenceList,
java.util.Vector encDataRefs)
Create DOM subtree for xenc:EncryptedKey |
org.w3c.dom.Element |
encryptForExternalRef(org.w3c.dom.Element dataRef,
java.util.Vector references)
Encrypt one or more parts or elements of the message (external). |
org.w3c.dom.Element |
encryptForInternalRef(org.w3c.dom.Element dataRef,
java.util.Vector references)
Encrypt one or more parts or elements of the message (internal). |
SecurityTokenReference |
getSecurityTokenReference()
|
java.lang.String |
getSymmetricEncAlgorithm()
Get the name of symmetric encryption algorithm to use. |
javax.crypto.SecretKey |
getSymmetricKey()
|
void |
prepare(org.w3c.dom.Document doc,
Crypto crypto)
Initialize a WSSec Encrypt. |
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 |
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 |
Methods inherited from class org.apache.ws.security.message.WSSecEncryptedKey |
createCipherValue, createEnrcyptedKey, generateEphemeralKey, getBinarySecurityTokenElement, getEncryptedKeyElement, getEphemeralKey, getId, prepareInternal, prependBSTElementToHeader, prependToHeader, setUserInfo, setUseThisCert |
Methods inherited from class org.apache.ws.security.message.WSSecBase |
getKeyIdentifierType, setBodyID, setKeyIdentifierType, setParts, 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 encCanonAlgo
protected byte[] embeddedKey
protected java.lang.String embeddedKeyName
protected javax.crypto.SecretKey symmetricKey
protected SecurityTokenReference securityTokenReference
Constructor Detail |
public WSSecEncrypt()
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_RSAOEP
public void setEmbeddedKeyName(java.lang.String embeddedKeyName)
embeddedKeyName
- public void setSymmetricEncAlgorithm(java.lang.String algo)
algo
- Is the name of the encryption algorithmWSConstants.TRIPLE_DES
,
WSConstants.AES_128
,
WSConstants.AES_192
,
WSConstants.AES_256
public 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 void prepare(org.w3c.dom.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
certificates
WSSecurityException
public org.w3c.dom.Document build(org.w3c.dom.Document doc, Crypto crypto, WSSecHeader secHeader) throws WSSecurityException
doc
- the SOAP envelope as Document
with plaintext
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 org.w3c.dom.Element encryptForInternalRef(org.w3c.dom.Element dataRef, java.util.Vector 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 vector containing WSEncryptionPart objects
xenc:Reference
element
WSSecurityException
public org.w3c.dom.Element encryptForExternalRef(org.w3c.dom.Element dataRef, java.util.Vector 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 the SecurityHeader. See addExternalRefElement()
.
If the dataRef
parameter is null
the method
creates and initializes a new Reference element.
dataRef
- A xenc:Reference
element or null
references
- A vector containing WSEncryptionPart objects
xenc:Reference
element
WSSecurityException
public void addInternalRefElement(org.w3c.dom.Element dataRef)
encryptForInternalRef()
method. The refernce element is
added to the EncryptedKey
element of this encrypt block.
dataRef
- The internal enc:Reference
elementpublic void addExternalRefElement(org.w3c.dom.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 static org.w3c.dom.Element createDataRefList(org.w3c.dom.Document doc, org.w3c.dom.Element referenceList, java.util.Vector encDataRefs)
xenc:EncryptedKey
doc
- the SOAP enevelope parent document
xenc:EncryptedKey
elementpublic javax.crypto.SecretKey getSymmetricKey()
public void setSymmetricKey(javax.crypto.SecretKey key)
key
- 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 |