powered by Jive Software

Rijndael class doesn`t work in Openfire 3.5.2. Please Help!

Hello, i have wrote the simple class to decrypt strings, which is coming from C# web application.

Here is the decrypt method

public String decrypt(String text) throws Exception{
Cipher cipher = Cipher.getInstance(“AES/CBC/PKCS5Padding”);
SecretKeySpec keySpec = new SecretKeySpec(key, “AES”);
IvParameterSpec ivSpec = new IvParameterSpec(iv);
cipher.init(Cipher.DECRYPT_MODE,keySpec,ivSpec);
BASE64Decoder decoder = new BASE64Decoder();
byte [] results = cipher.doFinal(decoder.decodeBuffer(text));
return new String(results,“UTF-8”);

}

This class works in standard java console application. But it started work only when i have replaced in %javahome%\jre6\lib\security directory local_policy.jar and US_export_policy.jar.

In the my plugin on openfire this method doesn`t work and raises the exception:

java.security.InvalidKeyException: Illegal key size
at javax.crypto.Cipher.a(DashoA13*…)
at javax.crypto.Cipher.a(DashoA13*…)
at javax.crypto.Cipher.a(DashoA13*…)
at javax.crypto.Cipher.init(DashoA13*…)
at javax.crypto.Cipher.init(DashoA13*…)
at com.wa.openfire.plugins.guidechat.rosterPresence.Encryption.decrypt(Encryption. java:43)
at com.wa.openfire.plugins.guidechat.operation.GetLicenseInfoOperation.execute(Get LicenseInfoOperation.java:43)
at com.wa.openfire.plugins.guidechat.rosterPresence.ChatOperationsHandlerServlet.d oGet(ChatOperationsHandlerServlet.java:48)
at com.wa.openfire.plugins.guidechat.rosterPresence.ChatOperationsHandlerServlet.d oPost(ChatOperationsHandlerServlet.java:76)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.jivesoftware.openfire.container.PluginServlet.handleServlet(PluginServlet.j ava:251)
at org.jivesoftware.openfire.container.PluginServlet.service(PluginServlet.java:91 )
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1093)
at org.jivesoftware.admin.PluginFilter.doFilter(PluginFilter.java:70)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1084)
at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:99)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1084)
at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:11 8)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.ja va:1084)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:726)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollect ion.java:206)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843 )
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:648)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)