From de28e95a26d2342abaa030164131fce4914582a6 Mon Sep 17 00:00:00 2001 From: Peter Boraros Date: Wed, 9 Nov 2011 02:21:26 +0100 Subject: [PATCH] Log some shits. --- src/cz/cvut/keyczar/HmacKey.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/cz/cvut/keyczar/HmacKey.java b/src/cz/cvut/keyczar/HmacKey.java index 978e271..999f149 100644 --- a/src/cz/cvut/keyczar/HmacKey.java +++ b/src/cz/cvut/keyczar/HmacKey.java @@ -99,14 +99,18 @@ public class HmacKey extends KeyczarKey { private Mac hmac; private long milis = 0; private int nanos = 0; + private boolean delay = false; public HmacStream() throws KeyczarException { - if ((System.getProperty("millis") != null) && (System.getProperty("nanos") != null)) { - this.milis = Long.parseLong(System.getProperty("millis")); + if ((System.getProperty("milis") != null) && (System.getProperty("nanos") != null)) { + this.milis = Long.parseLong(System.getProperty("milis")); this.nanos = Integer.parseInt(System.getProperty("nanos")); + if (milis != 0 && nanos != 0) delay = true; } - + if (delay) System.out.println("Delay setting: milis="+milis+", nanos="+nanos); + else System.out.println("Delay setting: none"); + try { hmac = Mac.getInstance(MAC_ALGORITHM); } catch (GeneralSecurityException e) { @@ -154,7 +158,7 @@ public class HmacKey extends KeyczarKey { if (macResult[pos] != sigBytes[pos]) { return false; } - if ((milis!=0) || (nanos!=0)) { + if (delay) { try { Thread.sleep(milis, nanos); } catch (InterruptedException e) {} }