You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by mu...@swiftdsl.com.au on 2004/04/14 02:53:48 UTC
Problems decrypting in Mailet
Hi All,
I am having some problems decrypting a value in a mailet ONLY within
James. The same code works when using a test class and simple running
it, however in the event I receive an email from a specific user I get
a ClassNotFoundError in James. The following is the code I am using in
my Mailet
package hieforums;
import java.io.*;
import org.apache.mailet.*;
import security.*;
public class HIEForumsMailet extends GenericMailet
{
public boolean checkEmailValidity(String encryptedValue)
{
try
{
String decryptedValue = new DesEncrypter(new File("C:\\Program
Files\\Tomcat 5.0\\webapps\\system.dat")).decrypt(encryptedValue);
System.out.println(decryptedValue);
return true;
}
catch(IOException e)
{
e.printStackTrace();
return false;
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
return false;
}
}
public void service(Mail mail)
{
try
{
String message = mail.getMessage().getContent().toString();
String encryptedValue = message.substring(message.indexOf("¦²n")+3,
message.length()).replaceAll("\n", "").replaceAll("\r", "").trim();
checkEmailValidity(encryptedValue);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
Attached is the encryption class DesEncrypter. Does james restrict the
available API or uses a cut down version or something? Any help on this
would be greatly appreciated as this is a rather frustrating problem.
Kindest Regards,
Matt Anderson
Re: Problems decrypting in Mailet
Posted by Serge Knystautas <se...@lokitech.com>.
muss@swiftdsl.com.au wrote:
> Hi All,
> I am having some problems decrypting a value in a mailet ONLY within
> James. The same code works when using a test class and simple running
> it, however in the event I receive an email from a specific user I get
> a ClassNotFoundError in James. The following is the code I am using in
> my Mailet
>
> package hieforums;
>
> import java.io.*;
> import org.apache.mailet.*;
> import security.*;
I would assume that you're missing a dependent class(es) or library(s).
What version of James are you using, and how are you bundling the
dependencies? I would recommend you use the 2.2.x test builds and take
advantage of the SAR-INF/lib and SAR-INF/classes as for 2.1.3 and
before, you had to bundle all your classes into the james.sar.
--
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org