|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.systinet.wasp.security.ws.ReferrableElement
org.systinet.wasp.security.ws.SecurityElement
org.systinet.wasp.security.ws.EncryptedData
Represents encrypted data.
To encrypt a message part, you need to create a token for encryption and initialize
EncryptedData instance using that token. Then you may add references
to message part(s), or specify that message body is to be encrypted by calling
setEncryptBody() method.
Default values
data encryption method:
http://www.w3.org/2001/04/xmlenc#tripledes-cbchttp://www.w3.org/2001/04/xmlenc#rsa-1_5wsse:SecurityTokenReference/wsse:KeyIdentifierX509Token.
ds:KeyNameSharedSecretToken.
Examples
Encrypting message body:
// create service client instance
ServiceClient serviceClient = ServiceClient.create("http://...");
// authenticate client and set the credentials
Credentials creds = WaspSecurity.acquireClientCredentials("Chris", "sirhC", "WS-Security");
WaspSecurity.setCredentials(serviceClient, new Credentials[]{creds});
WaspSecurity.setInitiatingProvider(serviceClient, "WS-Security");
// create service proxy
ServiceSoap svc = (ServiceSoap) serviceClient.createProxy(ServiceSoap.class);
// create new call security configuration
MessageSecurity ms = new MessageSecurity();
// create encrypting token
X509Token encryptingX509token = new X509Token();
// create new encrypted data
EncrytedData encData = new EncrytedData(encryptingX509token);
// set body encryption
encData.setEncryptBody();
// add the encrypted data to message security
ms.addSecurityElement(encData);
// set call message security
ms.setCallSecurity(serviceClient);
// invoke service method
svc.ping("EchoString");
X509Token,
SharedSecretToken,
MessageSecurity| Constructor Summary | |
EncryptedData(SecurityToken token)
Initializes a new EncryptedData instance with specified encrypting token. |
|
EncryptedData(SecurityToken token,
IdReference reference)
Initializes a new EncryptedData instance with specified encrypting token
and element reference. |
|
| Method Summary | |
void |
addReference(IdReference reference)
Adds a reference to element for encryption. |
void |
setEncryptBody()
Turns body encryption on. |
void |
setEncryptElementContent(boolean encryptElementContent)
If set to true, then only the element content will be subject to encryption;
otherwise, the whole element will be encrypted. |
void |
setEncryptionMethod(java.lang.String encryptionMethod)
Sets data encryption method. |
void |
setKeyEncryptionMethod(java.lang.String keyEncryptionMethod)
Sets key encryption method. |
void |
setSecurityTokenReferenceId(java.lang.String strId)
Sets value of the wsu:Id set on the SecurityTokenReference subelement of the tag
EncryptedKey/KeyInfo. |
| Methods inherited from class org.systinet.wasp.security.ws.SecurityElement |
getToken |
| Methods inherited from class org.systinet.wasp.security.ws.ReferrableElement |
getId, getIdForced, setId |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public EncryptedData(SecurityToken token)
EncryptedData instance with specified encrypting token.
token - token for encryption
public EncryptedData(SecurityToken token,
IdReference reference)
EncryptedData instance with specified encrypting token
and element reference. Referenced element will be encrypted.
Equivalent to
EncryptedData enc = new EncryptedData(token);
enc.addReference(new IdReference("..."));
token - token for encryptionreference - element reference| Method Detail |
public void addReference(IdReference reference)
reference - element referencepublic void setEncryptBody()
setEncryptElementContent(boolean) for more.
public void setEncryptElementContent(boolean encryptElementContent)
true, then only the element content will be subject to encryption;
otherwise, the whole element will be encrypted.
encryptElementContent - true to encrypt element content;
false to encrypt the whole element (default)public void setEncryptionMethod(java.lang.String encryptionMethod)
Constants.ALGO_ID_BLOCKCIPHER_TRIPLEDESConstants.ALGO_ID_BLOCKCIPHER_AES128Constants.ALGO_ID_BLOCKCIPHER_AES192Constants.ALGO_ID_BLOCKCIPHER_AES256
This method may only be called when EncryptedData is initialized
with X509Token - the setting is ignored otherwise.
encryptionMethod - data encryption methodpublic void setKeyEncryptionMethod(java.lang.String keyEncryptionMethod)
Constants.ALGO_ID_KEYTRANSPORT_RSA15Constants.ALGO_ID_KEYTRANSPORT_RSAOAEP
This method may only be called when EncryptedData is initialized
with X509Token - the setting is ignored otherwise.
keyEncryptionMethod - key encryption methodpublic void setSecurityTokenReferenceId(java.lang.String strId)
wsu:Id set on the SecurityTokenReference subelement of the tag
EncryptedKey/KeyInfo.
strId - the wsu:Id attribute value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||