29.07.2013 Views

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

throw new Exception(<br />

"An error has occured. Received the following error from the Currency<br />

Exchange Server:\n\n"<br />

+ status.message);<br />

}<br />

Debugger.debug(getClass(), 3, "Retrieving certificate...");<br />

RSsession.send(registrationInfo);<br />

NetPacket pack = RSsession.receive();<br />

if(pack instance<strong>of</strong> StatusPacket)<br />

{<br />

String error = ((StatusPacket) pack).message;<br />

Debugger.debug(getClass(), 3, "Error completing the registration " + error);<br />

throw new Exception(error);<br />

}<br />

else if(pack instance<strong>of</strong> ActivationCompletedPacket)<br />

{<br />

certificate = ((ActivationCompletedPacket) pack).certificate;<br />

FileHandler.export(certificate, new File(Config.clientCertificatePath));<br />

Debugger.debug(getClass(), 3, "Stored certificate successfully. Starting<br />

withdrawal.");<br />

gui.hideRegistrationDialog();<br />

gui.withdraw(Config.registrationCoinValue, CESusername, CESpassword);<br />

}<br />

else<br />

throw new Exception("Error in registration completion. Registration server<br />

responded unexpectedly.");<br />

byte[] testbytes = {2,99,7,45,56,7,7,89,98,7,78,4,12,3,4,4,23,22,3,4,45,45,32};<br />

Debugger.debug(getClass(), 1,"Test <strong>of</strong> the received certificate with the<br />

privatkey..."+((Cryptotools.verify((RSAPublicKey)getCertificate().getPublicKey(),Cryptoto<br />

ols.sign(getPrivateKey(), testbytes),testbytes)) ? "passed" : "failed"));<br />

}<br />

---<br />

---<br />

//-----------------------------------------------------------------------------------<br />

//Methods for the mail-proxy<br />

//-----------------------------------------------------------------------------------<br />

public void setAreAllMailsQueued(boolean b)<br />

{<br />

areAllMailsQueued = b;<br />

}<br />

public boolean getAreAllMailsQueued()<br />

{<br />

return areAllMailsQueued;<br />

}<br />

public void incomingMailProcessingCompleted()<br />

{<br />

POP3ServerShouldWait = false;<br />

wakeUptheSleeping();<br />

}<br />

/**<br />

* Monitor to make it possible for other processes to wait<br />

* until some job is done.<br />

* @param id int identifies which process made this call<br />

*/<br />

public synchronized void waitForOrderToGo(int id)<br />

{<br />

while(true)<br />

{<br />

try<br />

{<br />

//Debugger.debug(getClass(), 2, "I am awake !");<br />

207

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!