You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wss4j-dev@ws.apache.org by dk...@apache.org on 2009/06/11 19:00:40 UTC
svn commit: r783849 -
/webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java
Author: dkulp
Date: Thu Jun 11 17:00:40 2009
New Revision: 783849
URL: http://svn.apache.org/viewvc?rev=783849&view=rev
Log:
Use JCEMapper to map to the approriate JCE Cipher ID
Modified:
webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java
Modified: webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java
URL: http://svn.apache.org/viewvc/webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java?rev=783849&r1=783848&r2=783849&view=diff
==============================================================================
--- webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java (original)
+++ webservices/wss4j/branches/1_5_x-fixes/src/org/apache/ws/security/util/WSSecurityUtil.java Thu Jun 11 17:00:40 2009
@@ -757,17 +757,23 @@
public static Cipher getCipherInstance(String cipherAlgo)
throws WSSecurityException {
+
+ String jceid = JCEMapper.translateURItoJCEID(cipherAlgo);
Cipher cipher = null;
try {
- if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSA15)) {
- cipher = Cipher.getInstance("RSA/NONE/PKCS1PADDING");
- } else if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSAOEP)) {
- cipher = Cipher.getInstance("RSA/NONE/OAEPPADDING");
+ if (jceid == null) {
+ if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSA15)) {
+ cipher = Cipher.getInstance("RSA/NONE/PKCS1PADDING");
+ } else if (cipherAlgo.equalsIgnoreCase(WSConstants.KEYTRANSPORT_RSAOEP)) {
+ cipher = Cipher.getInstance("RSA/NONE/OAEPPADDING");
+ } else {
+ throw new WSSecurityException(
+ WSSecurityException.UNSUPPORTED_ALGORITHM,
+ "unsupportedKeyTransp", new Object[] {cipherAlgo}
+ );
+ }
} else {
- throw new WSSecurityException(
- WSSecurityException.UNSUPPORTED_ALGORITHM,
- "unsupportedKeyTransp", new Object[] {cipherAlgo}
- );
+ cipher = Cipher.getInstance(jceid);
}
} catch (NoSuchPaddingException ex) {
throw new WSSecurityException(
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org