summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/certsrv/base/Nonces.java
diff options
context:
space:
mode:
Diffstat (limited to 'pki/base/common/src/com/netscape/certsrv/base/Nonces.java')
-rw-r--r--pki/base/common/src/com/netscape/certsrv/base/Nonces.java26
1 files changed, 12 insertions, 14 deletions
diff --git a/pki/base/common/src/com/netscape/certsrv/base/Nonces.java b/pki/base/common/src/com/netscape/certsrv/base/Nonces.java
index 470ba654..cec105e0 100644
--- a/pki/base/common/src/com/netscape/certsrv/base/Nonces.java
+++ b/pki/base/common/src/com/netscape/certsrv/base/Nonces.java
@@ -21,11 +21,10 @@ import java.security.cert.X509Certificate;
import java.util.Hashtable;
import java.util.Vector;
-
/**
* This class manages nonces sometimes used to control request state flow.
* <P>
- *
+ *
* @version $Revision$, $Date$
*/
public class Nonces implements IAuthInfo {
@@ -53,17 +52,17 @@ public class Nonces implements IAuthInfo {
long i;
long k = 0;
long n = nonce;
- long m = (long)((mNonceLimit / 2) + 1);
+ long m = (long) ((mNonceLimit / 2) + 1);
for (i = 0; i < m; i++) {
k = n + i;
// avoid collisions
- if (!mNonceList.contains((Object)k)) {
+ if (!mNonceList.contains((Object) k)) {
break;
}
k = n - i;
// avoid collisions
- if (!mNonceList.contains((Object)k)) {
+ if (!mNonceList.contains((Object) k)) {
break;
}
}
@@ -71,9 +70,9 @@ public class Nonces implements IAuthInfo {
mNonceList.add(k);
mNonces.put(k, cert);
if (mNonceList.size() > mNonceLimit) {
- n = ((Long)(mNonceList.firstElement())).longValue();
+ n = ((Long) (mNonceList.firstElement())).longValue();
mNonceList.remove(0);
- mNonces.remove((Object)n);
+ mNonces.remove((Object) n);
}
} else {
// failed to resolved collision
@@ -83,15 +82,15 @@ public class Nonces implements IAuthInfo {
}
public X509Certificate getCertificate(long nonce) {
- X509Certificate cert = (X509Certificate)mNonces.get(nonce);
+ X509Certificate cert = (X509Certificate) mNonces.get(nonce);
return cert;
}
public X509Certificate getCertificate(int index) {
X509Certificate cert = null;
if (index >= 0 && index < mNonceList.size()) {
- long nonce = ((Long)(mNonceList.elementAt(index))).longValue();
- cert = (X509Certificate)mNonces.get(nonce);
+ long nonce = ((Long) (mNonceList.elementAt(index))).longValue();
+ cert = (X509Certificate) mNonces.get(nonce);
}
return cert;
}
@@ -99,17 +98,16 @@ public class Nonces implements IAuthInfo {
public long getNonce(int index) {
long nonce = 0;
if (index >= 0 && index < mNonceList.size()) {
- nonce = ((Long)(mNonceList.elementAt(index))).longValue();
+ nonce = ((Long) (mNonceList.elementAt(index))).longValue();
}
return nonce;
}
public void removeNonce(long nonce) {
- mNonceList.remove((Object)nonce);
- mNonces.remove((Object)nonce);
+ mNonceList.remove((Object) nonce);
+ mNonces.remove((Object) nonce);
}
-
public int size() {
return mNonceList.size();
}