public class IdentityStore extends AbstractBlock implements Serializable, Callable<Integer>, RunningDaemon
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
CRLF
Constructor and Description |
---|
IdentityStore() |
IdentityStore(byte[] b) |
IdentityStore(File f)
Create object from ASN.1 encoded file.
|
Modifier and Type | Method and Description |
---|---|
void |
add(IdentityStoreBlock isb)
Adds an existing identity store block to the store.
|
Integer |
call() |
String |
dumpValueNotation(String prefix,
DumpType dumpType) |
Set<IdentityStoreBlock> |
getAnonSet(int size)
Gets a random set of known recipient identities.
|
AsymmetricKey |
getHostIdentity()
Get the own identity key.
|
IdentityStoreBlock |
getIdentity(String id) |
String[] |
getIdentityList() |
static IdentityStore |
getIdentityStoreDemo()
Creates a new complete dummy identity store suitable for testing purposes.
|
static IdentityStore |
getNewIdentityStoreDemo(boolean complete)
Creates a new dummy identity store suitable for testing purposes.
|
protected void |
parse(org.bouncycastle.asn1.ASN1Encodable p) |
protected void |
parse(byte[] p) |
void |
removeAddress(String nodeAddress)
removes a node address from the identity store.
|
static void |
resetDemo() |
AsymmetricKey |
setHostIdentity(AsymmetricKey identity)
Sets the owned key.
|
void |
shutdownDaemon()
Shuts this class down.
|
void |
startDaemon()
Initializes and starts all threads required to run the daemon.
|
void |
stopDaemon()
Stopps all daemon threads and frees all temporary resources.
|
org.bouncycastle.asn1.ASN1Object |
toAsn1Object(DumpType dumpType)
Dumps an ASN.1 representation of the object.
|
fromBase64, fromHex, prepareDump, toBase64, toBitString, toBytes, toDer, toHex
public static final long serialVersionUID
public IdentityStore()
public IdentityStore(byte[] b) throws IOException
IOException
public IdentityStore(File f) throws IOException
Create object from ASN.1 encoded file.
f
- the file to be parsedIOException
- if parsing of ASN.1 code failspublic static void resetDemo()
public static IdentityStore getIdentityStoreDemo() throws IOException
Creates a new complete dummy identity store suitable for testing purposes.
IOException
- if building of the store failspublic static IdentityStore getNewIdentityStoreDemo(boolean complete) throws IOException
Creates a new dummy identity store suitable for testing purposes.
the identity store contains an own identity, one hundred node idetities and 40 recipient identities.
complete
- if true the node and recipient identities contain the private key tooIOException
- if building of the store failspublic AsymmetricKey getHostIdentity()
Get the own identity key.
public AsymmetricKey setHostIdentity(AsymmetricKey identity)
Sets the owned key.
identity
- identity key to be set as own keypublic String[] getIdentityList()
public Set<IdentityStoreBlock> getAnonSet(int size) throws IOException
Gets a random set of known recipient identities.
size
- the size of the anonymity setIOException
- if requested anonymity set size is too big for this storeprotected final void parse(byte[] p) throws IOException
parse
in class AbstractBlock
IOException
protected final void parse(org.bouncycastle.asn1.ASN1Encodable p) throws IOException
parse
in class AbstractBlock
IOException
public void add(IdentityStoreBlock isb)
Adds an existing identity store block to the store.
isb
- the block to be addedpublic void removeAddress(String nodeAddress) throws IOException
removes a node address from the identity store.
nodeAddress
- the node addrress to be removedIOException
- if node address is not contained in identity storepublic org.bouncycastle.asn1.ASN1Object toAsn1Object(DumpType dumpType) throws IOException
Dumpable
Dumps an ASN.1 representation of the object.
toAsn1Object
in interface Dumpable
dumpType
- the dump type to be usedIOException
- if dumping of the object fails due to an illegal internal state of the
objectpublic String dumpValueNotation(String prefix, DumpType dumpType) throws IOException
dumpValueNotation
in interface Block
IOException
public IdentityStoreBlock getIdentity(String id)
public void startDaemon()
RunningDaemon
Initializes and starts all threads required to run the daemon.
startDaemon
in interface RunningDaemon
public void stopDaemon()
RunningDaemon
Stopps all daemon threads and frees all temporary resources.
stopDaemon
in interface RunningDaemon
public void shutdownDaemon()
RunningDaemon
Shuts this class down.
This frees all resources and ends all threads for an application or layer shutdown. It is not possible to call start() after running shutdown().
shutdownDaemon
in interface RunningDaemon
Copyright © 2023. All rights reserved.