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.

new.");<br />

}<br />

catch(Exception e)<br />

{<br />

//Debugger.debug(getClass(), 1, "Blacklist could not be loaded. Creating<br />

}<br />

try<br />

{<br />

blacklist = new Blacklist();<br />

CESCert = FileHandler.importCertificate(new File(Config.CESCertificateName));<br />

RSCert = FileHandler.importCertificate(new File(Config.RSCertificateName));<br />

RSPublicKey = (RSAPublicKey) RSCert.getPublicKey();<br />

CESPublicKey = (RSAPublicKey) CESCert.getPublicKey();<br />

}<br />

catch(Exception ex)<br />

{<br />

//Debugger.debug(getClass(), 1, "Initializationexception...", ex);<br />

}<br />

public void printStatus()<br />

{<br />

//Debugger.debug(getClass(), 1, "Status:\n" + blacklist.toString());<br />

}<br />

public static void main(String[] args)<br />

{<br />

try<br />

{<br />

//Debugger.setApplicationName("BlacklistServer");<br />

new BlackListServer();<br />

}<br />

catch(FileNotFoundException ex)<br />

{<br />

//Debugger.debug(BlackListServer.class, 1, "Initializationexception...file<br />

not found " + ex.getMessage(), ex);<br />

}<br />

catch(Exception ex)<br />

{<br />

//Debugger.debug(BlackListServer.class, 1, "Initializationexception...", ex);<br />

}<br />

}<br />

public synchronized BlacklistPacket getBlacklist(GetBlacklistPacket getPacket)<br />

{<br />

count++;<br />

return new BlacklistPacket(blacklist.getFromIndex(getPacket.splitIndex));<br />

}<br />

public synchronized void reportCoins(ReportCoinsPacket pack) throws Exception<br />

{<br />

if(firsttime)<br />

{<br />

System.out.println("Starting measurements...");<br />

time = System.currentTimeMillis();<br />

count = 0;<br />

firsttime = false;<br />

}<br />

Coin a = pack.a;<br />

Coin b = pack.b;<br />

//Debugger.debug(getClass(), 1, "\n\nThe following coins have been reported. List<br />

size :"+this.blacklist.elements.size());<br />

//Debugger.debug(getClass(), 1, a.toString());<br />

//Debugger.debug(getClass(), 1, b.toString());<br />

//Debugger.debug(getClass(), 1, "Testing if the coins have the same<br />

serialnumber");<br />

338

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

Saved successfully!

Ooh no, something went wrong!