com.ibm.websphere.wssecurity.wssapi.encryption
Interface WSSEncryption
-
public interface WSSEncryptionThis interface is responsible for the encryption component. There are the values to set as default.- Target of encryption
- BODY_CONTENT, SIGNATURE
- data encryption method
- AES128
- key encryption method
- KW_RSA_OAEP
WSSFactory factory = WSSFactory.getInstance(); WSSGenerationContext gencont = factory.newWSSGenerationContext(); X509GenerateCallbackHandler callbackhandler = generateCallbackHandler(); SecurityToken token = factory.newSecurityToken(X509Token.class, callbackHandler); WSSEncryption enc = factory.newWSSEncryption(token); gencont.add(enc);- See Also:
WSSEncryptPart
- Target of encryption
-
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.StringAES128The URI for the data encryption algorithm, AES 128: http://www.w3.org/2001/04/xmlenc#aes128-cbc.static java.lang.StringAES192The URI for the data encryption algorithm, AES 192: http://www.w3.org/2001/04/xmlenc#aes192-cbcstatic java.lang.StringAES256The URI for the data encryption algorithm, AES 256: http://www.w3.org/2001/04/xmlenc#aes256-cbcstatic intBODY_CONTENTThe keyword for the body content of the SOAP message as an encryption part.static java.lang.StringKW_AES128The URI for the key encryption algorithm, key wrap AES 128: http://www.w3.org/2001/04/xmlenc#kw-aes128.static java.lang.StringKW_AES192The URI for the key encryption algorithm, key wrap AES 192: http://www.w3.org/2001/04/xmlenc#kw-aes192.static java.lang.StringKW_AES256The URI for the key encryption algorithm, key wrap AES 256: http://www.w3.org/2001/04/xmlenc#kw-aes256.static java.lang.StringKW_RSA_OAEPThe URI for the key encryption algorithm, key wrap RSA OAEP: http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.static java.lang.StringKW_RSA15The URI for the key encryption algorithm, key wrap RSA 1.5: http://www.w3.org/2001/04/xmlenc#rsa-1_5.static java.lang.StringKW_TRIPLE_DESThe URI for the key encryption algorithm, key wrap triple DES: http://www.w3.org/2001/04/xmlenc#kw-tripledes.static intSIGNATUREThe keyword for the signature as a encryption part.static java.lang.StringTRIPLE_DESThe URI for the data encryption algorithm, triple DES: http://www.w3.org/2001/04/xmlenc#tripledes-cbc.
-
Method Summary
Methods Modifier and Type Method and Description voidaddEncryptHeader(javax.xml.namespace.QName header)Adds the header in the SOAP Header, specified by QName, as an encrypted part.voidaddEncryptPart(int keyword)Adds the keyword of the encrypted part, such as BODY_CONTENT, SIGNATURE.voidaddEncryptPart(SecurityToken securityToken, boolean isElement)Adds the security token object as an encrypted part.voidaddEncryptPart(WSSEncryptPart part)Adds the WSSEncryptPart object as an encrypted part.voidaddEncryptPart(WSSSignature signature)Adds the signature component as an encrypted part.voidaddEncryptPartByXPath(java.lang.String xpath)Adds an XPath expression as an encrypted part.voidencryptKey(boolean isEncrypt)Call this method with true as an argument, when the shared key is encrypted.voidsetEncryptionMethod(java.lang.String algorithm)Sets the data encryption method.voidsetKeyEncryptionMethod(java.lang.String algorithm)Set the key encryption method.voidsetOptimize(boolean mtomOptimize)Sets MTOM optimization of the encrypted part.voidsetTokenReference(int refType)Sets the type of the security token reference.
-
-
-
Field Detail
-
BODY_CONTENT
static final int BODY_CONTENT
The keyword for the body content of the SOAP message as an encryption part.- See Also:
- Constant Field Values
-
SIGNATURE
static final int SIGNATURE
The keyword for the signature as a encryption part.- See Also:
- Constant Field Values
-
TRIPLE_DES
static final java.lang.String TRIPLE_DES
The URI for the data encryption algorithm, triple DES: http://www.w3.org/2001/04/xmlenc#tripledes-cbc.- See Also:
- Constant Field Values
-
AES128
static final java.lang.String AES128
The URI for the data encryption algorithm, AES 128: http://www.w3.org/2001/04/xmlenc#aes128-cbc.- See Also:
- Constant Field Values
-
AES192
static final java.lang.String AES192
The URI for the data encryption algorithm, AES 192: http://www.w3.org/2001/04/xmlenc#aes192-cbc- See Also:
- Constant Field Values
-
AES256
static final java.lang.String AES256
The URI for the data encryption algorithm, AES 256: http://www.w3.org/2001/04/xmlenc#aes256-cbc- See Also:
- Constant Field Values
-
KW_TRIPLE_DES
static final java.lang.String KW_TRIPLE_DES
The URI for the key encryption algorithm, key wrap triple DES: http://www.w3.org/2001/04/xmlenc#kw-tripledes.
It is an algorithm for the WS-Secure Conversation.- See Also:
- Constant Field Values
-
KW_AES128
static final java.lang.String KW_AES128
The URI for the key encryption algorithm, key wrap AES 128: http://www.w3.org/2001/04/xmlenc#kw-aes128.
It is an algorithm for the WS-Secure Conversation.- See Also:
- Constant Field Values
-
KW_AES192
static final java.lang.String KW_AES192
The URI for the key encryption algorithm, key wrap AES 192: http://www.w3.org/2001/04/xmlenc#kw-aes192.
It is an algorithm for the WS-Secure Conversation.- See Also:
- Constant Field Values
-
KW_AES256
static final java.lang.String KW_AES256
The URI for the key encryption algorithm, key wrap AES 256: http://www.w3.org/2001/04/xmlenc#kw-aes256.
It is an algorithm for the WS-Secure Conversation.- See Also:
- Constant Field Values
-
KW_RSA15
static final java.lang.String KW_RSA15
The URI for the key encryption algorithm, key wrap RSA 1.5: http://www.w3.org/2001/04/xmlenc#rsa-1_5.- See Also:
- Constant Field Values
-
KW_RSA_OAEP
static final java.lang.String KW_RSA_OAEP
The URI for the key encryption algorithm, key wrap RSA OAEP: http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p.- See Also:
- Constant Field Values
-
-
Method Detail
-
addEncryptPart
void addEncryptPart(int keyword) throws WSSExceptionAdds the keyword of the encrypted part, such as BODY_CONTENT, SIGNATURE.- Parameters:
keyword- part to be encrypted- Throws:
WSSException- if the keyword is not valid.
-
addEncryptPart
void addEncryptPart(WSSEncryptPart part)
Adds the WSSEncryptPart object as an encrypted part.- Parameters:
part- part to be encrypted
-
addEncryptPart
void addEncryptPart(WSSSignature signature)
Adds the signature component as an encrypted part.- Parameters:
signature- part to be encrypted
-
addEncryptHeader
void addEncryptHeader(javax.xml.namespace.QName header)
Adds the header in the SOAP Header, specified by QName, as an encrypted part.- Parameters:
header- part to be encrypted
-
addEncryptPartByXPath
void addEncryptPartByXPath(java.lang.String xpath)
Adds an XPath expression as an encrypted part.- Parameters:
xpath- encryption part
-
setEncryptionMethod
void setEncryptionMethod(java.lang.String algorithm) throws WSSExceptionSets the data encryption method.- Parameters:
algorithm- data encryption algorithm- Throws:
WSSException- the algorithm is not supported
-
setKeyEncryptionMethod
void setKeyEncryptionMethod(java.lang.String algorithm) throws WSSExceptionSet the key encryption method.- Parameters:
algorithm- key encryption algorithm- Throws:
WSSException- the algorithm is not supported
-
encryptKey
void encryptKey(boolean isEncrypt)
Call this method with true as an argument, when the shared key is encrypted. Call this method with false as an argument, when the shared key is not encrypted. The default is true.- Parameters:
isEncrypt- true, if the shared key is to be encrypted.
false, if the shared key is not to be encrypted.
-
setTokenReference
void setTokenReference(int refType) throws WSSExceptionSets the type of the security token reference. Such as SecurityToken.REF_STR, SecurityToken.REF_KEYID, or SecurityToken.REF_EMBEDDED.- Parameters:
refType- reference type of the security token- Throws:
WSSException- if the refType is not valid.
-
addEncryptPart
void addEncryptPart(SecurityToken securityToken, boolean isElement)
Adds the security token object as an encrypted part.- Parameters:
securityToken- part to be encryptedisElement- Specifies whether the encrypted part is an element. If set to true, the encrypted part is an element; if set to false, the encrypted part is its content only.
-
setOptimize
void setOptimize(boolean mtomOptimize)
Sets MTOM optimization of the encrypted part.- Parameters:
mtomOptimize- boolean flag indicating whether the encrypted part should be optimized for MTOM.
-
-