|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.flatfile.NonceMap
public class NonceMap
An abstraction to track nonces on the server-side. It will also ensure that the same nonce isn't being used twice during operation of the server.
| Field Summary | |
|---|---|
static int |
DEFAULT_MAX_NONCES
Default maximum number of nonces to store in memory. |
static int |
NONCE_BYTES
Size of nonce in bytes |
| Constructor Summary | |
|---|---|
NonceMap(FlatFileTrancheServer trancheServer)
|
|
NonceMap(RoutingTrancheServer trancheServer)
|
|
| Method Summary | |
|---|---|
boolean |
contains(byte[] nonce)
Check to see whether the nonce bytes are valid. |
int |
getMaximumSize()
Get maximum size of NonceMap. |
byte[] |
newNonce()
Create a new nonce. |
void |
remove(byte[] nonce)
Remove nonce from collection of valid nonces. |
void |
setMaximumSize(int maxSize,
java.security.cert.X509Certificate cert,
java.security.PrivateKey key)
Sets the maximum size in the Configuration for the FlatFileTrancheServer. |
int |
size()
Total number of nonces currently in collection. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NONCE_BYTES
public static final int DEFAULT_MAX_NONCES
Default maximum number of nonces to store in memory.
| Constructor Detail |
|---|
public NonceMap(FlatFileTrancheServer trancheServer)
public NonceMap(RoutingTrancheServer trancheServer)
| Method Detail |
|---|
public boolean contains(byte[] nonce)
Check to see whether the nonce bytes are valid.
nonce - the nonce bytes
true if the hash map contains the nonce bytes;
false otherwisepublic byte[] newNonce()
Create a new nonce.
public int getMaximumSize()
Get maximum size of NonceMap. Note this is always up to date because checks FlatFileTrancheServer's configuration, so don't call too often.
There's an private version of this method, getMethodSizeInternal, that uses a cached version to save time.
public void setMaximumSize(int maxSize,
java.security.cert.X509Certificate cert,
java.security.PrivateKey key)
throws java.lang.Exception
Sets the maximum size in the Configuration for the FlatFileTrancheServer.
maxSize - cert - key -
java.lang.Exceptionpublic void remove(byte[] nonce)
Remove nonce from collection of valid nonces.
nonce - the nonce bytes to remove from the collectionpublic int size()
Total number of nonces currently in collection.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||