public class IdentityBlock extends AbstractBlock implements Serializable, Dumpable
Represents an identity block of a vortexMessage.
Modifier and Type | Class and Description |
---|---|
static class |
IdentityBlock.IdentityStatus |
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
CRLF
Constructor and Description |
---|
IdentityBlock()
Creates a new IdentityBlock with a medium security default key.
|
IdentityBlock(org.bouncycastle.asn1.ASN1Encodable to)
Create object from ASN.1 code.
|
IdentityBlock(org.bouncycastle.asn1.ASN1Encodable to,
AsymmetricKey ownIdentity)
Create object from encrypted ASN.1 code.
|
IdentityBlock(AsymmetricKey key)
Generates a new IdentityBlock for the given key.
|
IdentityBlock(byte[] b)
Parses the given unecrypted identity block.
|
IdentityBlock(byte[] b,
AsymmetricKey ownIdentity)
Parses the given identity block using the specified key.
|
Modifier and Type | Method and Description |
---|---|
String |
dumpValueNotation(String prefix) |
String |
dumpValueNotation(String prefix,
DumpType dumpType)
Dumps the current block state in ASN.1 value notation.
|
boolean |
equals(Object t) |
AsymmetricKey |
getIdentityKey()
Gets the identity representation (asymmetric key) of the block.
|
AsymmetricKey |
getOwnIdentity()
Gets the identity representation (asymmetric key) of the block.
|
int |
getReplay()
Gets the maximum number of replays for this block.
|
long |
getSerial()
Get the serial of the identity block.
|
UsagePeriod |
getUsagePeriod()
Gets the currently set validity period of the block.
|
int |
hashCode() |
protected void |
parse(org.bouncycastle.asn1.ASN1Encodable o) |
AsymmetricKey |
setIdentityKey(AsymmetricKey oid)
Sets the identity representation (asymmetric key) of the block.
|
AsymmetricKey |
setOwnIdentity(AsymmetricKey oid)
Sets the identity representation (asymmetric key) of the block.
|
int |
setReplay(int maxReplay)
Sets the maximum number of replays for this block.
|
void |
setRequests(HeaderRequest[] hr) |
long |
setSerial(long serial)
Set the serial of the identity block.
|
UsagePeriod |
setUsagePeriod(UsagePeriod valid)
Sets the maximum usage period of the block.
|
org.bouncycastle.asn1.ASN1Object |
toAsn1Object(DumpType dumpType)
Dumps the identity block as ASN.1 der encoded object.
|
org.bouncycastle.asn1.ASN1Object |
toAsn1Object(DumpType dumpType,
AsymmetricKey targetIdentity)
Dumps the identity block as ASN.1 der encoded object.
|
String |
toString() |
fromBase64, fromHex, parse, prepareDump, toBase64, toBitString, toBytes, toDer, toHex
public static final long serialVersionUID
public IdentityBlock() throws IOException
Creates a new IdentityBlock with a medium security default key.
This is a convenience wrapper for @see IdentityBlock(AsymmetricKey)
IOException
- if generation of the key failspublic IdentityBlock(AsymmetricKey key) throws IOException
Generates a new IdentityBlock for the given key.
The new identity block is characterized by 1 replay (not replayable), a random serial, a usage perod of 1 hour, and no requests.
key
- the key to be usedIOException
- if generation of the block failspublic IdentityBlock(byte[] b, AsymmetricKey ownIdentity) throws IOException
Parses the given identity block using the specified key.
b
- a byte array reflecting the encrypted IdentityBlockownIdentity
- the identity to be used to decrypt the blockIOException
- if parsing fails for any reasonpublic IdentityBlock(byte[] b) throws IOException
Parses the given unecrypted identity block.
b
- a byte array reflecting the IdentityBlockIOException
- if parsing fails for any reasonpublic IdentityBlock(org.bouncycastle.asn1.ASN1Encodable to) throws IOException
Create object from ASN.1 code.
to
- the ASN.1 codeIOException
- if parsing of ASN.1 code failspublic IdentityBlock(org.bouncycastle.asn1.ASN1Encodable to, AsymmetricKey ownIdentity) throws IOException
Create object from encrypted ASN.1 code.
to
- the ASN.1 codeownIdentity
- the identity to be used to decrypt the blockIOException
- if parsing of ASN.1 code failspublic void setRequests(HeaderRequest[] hr)
protected final void parse(org.bouncycastle.asn1.ASN1Encodable o) throws IOException
parse
in class AbstractBlock
IOException
public int getReplay()
Gets the maximum number of replays for this block.
public int setReplay(int maxReplay)
Sets the maximum number of replays for this block.
maxReplay
- the maximum nuber of replays to be setpublic UsagePeriod getUsagePeriod()
Gets the currently set validity period of the block.
public UsagePeriod setUsagePeriod(UsagePeriod valid)
Sets the maximum usage period of the block.
valid
- the new usage period to be setpublic AsymmetricKey getOwnIdentity()
Gets the identity representation (asymmetric key) of the block.
public AsymmetricKey setOwnIdentity(AsymmetricKey oid)
Sets the identity representation (asymmetric key) of the block.
oid
- the identity keypublic AsymmetricKey getIdentityKey()
Gets the identity representation (asymmetric key) of the block.
public AsymmetricKey setIdentityKey(AsymmetricKey oid)
Sets the identity representation (asymmetric key) of the block.
oid
- the identity keypublic org.bouncycastle.asn1.ASN1Object toAsn1Object(DumpType dumpType) throws IOException
Dumps the identity block as ASN.1 der encoded object.
toAsn1Object
in interface Dumpable
dumpType
- the dump type to be usedIOException
- if the block is not encodablepublic org.bouncycastle.asn1.ASN1Object toAsn1Object(DumpType dumpType, AsymmetricKey targetIdentity) throws IOException
Dumps the identity block as ASN.1 der encoded object.
dumpType
- the type of dump to be usedtargetIdentity
- the identity to be used to secure the Identity block (target identity)IOException
- if the block is not encodablepublic String dumpValueNotation(String prefix) throws IOException
IOException
public String dumpValueNotation(String prefix, DumpType dumpType) throws IOException
Dumps the current block state in ASN.1 value notation.
dumpValueNotation
in interface Block
prefix
- the prefix to be prepended to each line (whitespaces for indentation)dumpType
- the type of dump to be usedIOException
- if the block is not encodablepublic long getSerial()
Get the serial of the identity block.
public long setSerial(long serial)
Set the serial of the identity block.
serial
- the serial to be setCopyright © 2023. All rights reserved.