Encryption methods

For request generator binding settings, the encryption methods include specifying the data and key encryption algorithms to use to encrypt the SOAP message. The WSS API for encryption (WSSEncryption) specifies the algorithm name and the matching algorithm uniform resource identifier (URI) for the data and key encryption methods. If the data and key encryption algorithms are specified, only elements that are encrypted with those algorithms are accepted.

Data encryption algorithms

The data encryption algorithm is used to encrypt parts of the SOAP message, including the body and the signature. Data encryption algorithms specify the algorithm uniform resource identifier (URI) for each type of data encryption algorithms.

The following pre-configured data encryption algorithms are supported:
Table 1. Data encryption algorithms. The algorithms are used to encrypt SOAP messages.
Data encryption algorithm name Algorithm URI
WSSEncryption.AES128 (the default value) A URI of data encryption algorithm, AES 128: http://www.w3.org/2001/04/xmlenc#aes128-cbc
WSSEncryption.AES192 A URI of data encryption algorithm, AES 192: http://www.w3.org/2001/04/xmlenc#aes192-cbc
WSSEncryption.AES256 A URI of data encryption algorithm, AES 256: http://www.w3.org/2001/04/xmlenc#aes256-cbc
WSSEncryption.TRIPLE_DES A URI of data encryption algorithm, TRIPLE DES: http://www.w3.org/2001/04/xmlenc#tripledes-cbc

By default, the Java™ Cryptography Extension (JCE) is shipped with restricted or limited strength ciphers. To use 192-bit and 256-bit Advanced Encryption Standard (AES) encryption algorithms, you must apply unlimited jurisdiction policy files.

Important: 您的原住地對於加密軟體的輸入、佔有、使用或重新輸出至另一個國家或地區等方面可能會有一些限制。在下載或使用未限定的原則檔之前,您必須先查核您所在國家或地區的法令、規章,以及其對於加密軟體的輸入、佔有、使用或重新輸出等方面的政策,來判定是否允許這麼做。

For the AES256-cbc and the AES192-CBC algorithms, you must download the unrestricted Java™ Cryptography Extension (JCE) policy files from the following website: http://www.ibm.com/developerworks/java/jdk/security/index.html.

The data encryption algorithm configured for encryption for the generator side must match the data encryption algorithm that is configured for decryption for the consumer side.

Key encryption algorithms

This algorithm is used to encrypt and decrypt keys. This key information is used to specify the configuration that is needed to generate the key for digital signature and encryption. The signing information and encryption information configurations can share the key information. The key information on the consumer side is used for specifying the information about the key that is used for validating the digital signature in the received message or for decrypting the encrypted parts of the message. The request generator is configured for the client.

Note: Policy sets do not support symmetric key encryption. If you are using the WSS API for symmetric key encryption, you will not be able to interoperate with web services endpoints using the policy sets.

Key encryption algorithms specify the algorithm uniform resource identifier (URI) of the key encryption method. The following pre-configured key encryption algorithms are supported:

Table 2. Supported pre-configured key encryption algorithms. The algorithms are used to encrypt and decrypt keys.
WSS API URI
WSSEncryption.KW_AES128 A URI of key encryption algorithm, key wrap AES 128: http://www.w3.org/2001/04/xmlenc#kw-aes128
WSSEncryption.KW_AES192 A URI of key encryption algorithm, key wrap AES 192: http://www.w3.org/2001/04/xmlenc#kw-aes192
Restriction: Do not use the 192-bit key encryption algorithm if you want your configured application to be in compliance with the Basic Security Profile (BSP).
WSSEncryption.KW_AES256 A URI of key encryption algorithm, key wrap AES 256: http://www.w3.org/2001/04/xmlenc#kw-aes256
WSSEncryption.KW_RSA_OAEP (the default value) A URI of key encryption algorithm, key wrap RSA OAEP: http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p
WSSEncryption.KW_RSA15 A URI of key encryption algorithm, key wrap RSA 1.5: http://www.w3.org/2001/04/xmlenc#rsa-1_5
WSSEncryption.KW_TRIPLE_DES A URI of key encryption algorithm, key wrap TRIPLE DES: http://www.w3.org/2001/04/xmlenc#kw-tripledes
For Secure Conversation, additional key-related information must be specified, such as:
  • algorithmName
  • keyLength
By default, the RSA-OAEP algorithm uses the SHA1 message digest algorithm to compute a message digest as part of the encryption operation. Optionally, you can use the SHA256 or SHA512 message digest algorithm by specifying a key encryption algorithm property. The property name is: com.ibm.wsspi.wssecurity.enc.rsaoaep.DigestMethod. The property value is one of the following URIs of the digest method:
  • http://www.w3.org/2001/04/xmlenc#sha256
  • http://www.w3.org/2001/04/xmlenc#sha512

By default, the RSA-OAEP algorithm uses a null string for the optional encoding octet string for the OAEPParams. You can provide an explicit encoding octet string by specifying a key encryption algorithm property. For the property name, you can specify com.ibm.wsspi.wssecurity.enc.rsaoaep.OAEPparams. The property value is the base 64-encoded value of the octet string.

Important: You can set these digest method and OAEPParams properties on the generator side only. On the consumer side, these properties are read from the incoming SOAP message.

For the KW-AES256 and the KW-AES192 key encryption algorithms, you must download the unrestricted JCE policy files from the following website: http://www.ibm.com/developerworks/java/jdk/security/index.html.

The key encryption algorithm for the generator must match the key decryption algorithm that is configured for the consumer.

This example provides sample code for encryption to use the Triple DES for the data encryption method and to use RSA1.5 for the key encryption method:

	  // get the message context
	  Object msgcontext = getMessageContext();

	  // generate WSSFactory instance
	  WSSFactory factory = WSSFactory.getInstance();		

	  // generate WSSGenerationContext instance
	  WSSGenerationContext gencont = factory.newWSSGenerationContext();

	  // generate callback handler
	  X509GenerateCallbackHandler callbackHandler = new X509GenerateCallbackHandler(
			  "",
			  "enc-sender.jceks",
			  "jceks", 
			  "storepass".toCharArray(), 
			  "bob", 
			  null, 
			  "CN=Bob, O=IBM, C=US", 
			  null);

	  // generate the security token used to the encryption
	  SecurityToken token = factory.newSecurityToken(X509Token.class, 
        callbackHandler);

	  // generate WSSEncryption instance to encrypt the SOAP body content
	  WSSEncryption enc = factory.newWSSEncryption(token);
	  enc.addEncryptPart(WSSEncryption.BODY_CONTENT);

	  // set the data encryption method
	  // DEFAULT: WSSEncryption.AES128
	  enc.setEncryptionMethod(WSSEncryption.TRIPLE_DES);

	  // set the key encryption method
	  // DEFAULT: WSSEncryption.KW_RSA_OAEP
	  enc.setEncryptionMethod(WSSEncryption.KW_RSA15);

	  // add the WSSEncryption to the WSSGenerationContext
	  gencont.add(enc);

	  // generate the WS-Security header
	  gencont.process(msgcontext);

指出主題類型的圖示 參照主題



時間戳記圖示 前次更新: July 9, 2016 11:14
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=cord&product=was-nd-mp&topic=rwbs_wssencryptalgorithms
檔名:rwbs_wssencryptalgorithms.html