Class IdentityStoreBlock

java.lang.Object
net.messagevortex.asn1.AbstractBlock
net.messagevortex.asn1.IdentityStoreBlock
All Implemented Interfaces:
Serializable, Block, Dumpable

public class IdentityStoreBlock extends AbstractBlock implements Serializable
This class represents one block of an identity store for storage.
See Also:
  • Field Details

  • Constructor Details

    • IdentityStoreBlock

      public IdentityStoreBlock()
    • IdentityStoreBlock

      public IdentityStoreBlock(org.bouncycastle.asn1.ASN1Encodable ae) throws IOException

      Create object from ASN.1 code.

      Parameters:
      ae - the ASN.1 code
      Throws:
      IOException - if parsing of ASN.1 code fails
    • IdentityStoreBlock

      public IdentityStoreBlock(String url) throws IOException

      Create an identity store block from an url.

      Parameters:
      url - th url to be parsed
      Throws:
      IOException - if parsing of the url fails
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getIdentityStoreBlockDemo

      public static IdentityStoreBlock getIdentityStoreBlockDemo(IdentityStoreBlock.IdentityType it, String id, boolean complete) throws IOException

      Get a new, random IdentityStoreBlock of the specified type.

      Parameters:
      it - identity type to be generated
      id - the id of the generated block
      complete - provide only the specified subset or a complete entry with private keys
      Returns:
      the requessted IdentityStoreBlock
      Throws:
      IOException - if generation fails
    • setIdentityKey

      public AsymmetricKey setIdentityKey(AsymmetricKey k)

      Set a new identity key.

      Parameters:
      k - the new identity key
      Returns:
      the previously set identity key
    • getIdentityKey

      public AsymmetricKey getIdentityKey()

      get the currently set identity key.

      Returns:
      the identity key currently set
    • setValid

      public UsagePeriod setValid(UsagePeriod np)

      The usage period of the identity block.

      Parameters:
      np - the validity period to be set
      Returns:
      the previously set validity period
    • getValid

      public UsagePeriod getValid()

      Gets the currently set validity period.

      Returns:
      the currently set validity period
    • setMessageQuota

      public int setMessageQuota(int nq)

      Setting the limit for number of incoming messages.

      Parameters:
      nq - the new quota
      Returns:
      the previously set quota
    • getMessageQuota

      public int getMessageQuota()

      Getting the limit for number of incoming messages.

      Returns:
      the currently set limit
    • setTransferQuota

      public int setTransferQuota(int tq)

      Setting the limmit for the outgoing transfer quotas in bytes.

      Parameters:
      tq - the new transfer quotas in bytes
      Returns:
      the previously set quota
    • getTransferQuota

      public int getTransferQuota()

      Getting the transfer quota in bytes for outgoing messages.

      Returns:
      the currently set transfer quota
    • setNodeAddress

      public String setNodeAddress(String na)

      Setting the node address.

      Parameters:
      na - the new node address
      Returns:
      the previously set node address
    • getNodeAddress

      public String getNodeAddress()

      Getting the currently set node address.

      Returns:
      the currently set node address
    • setNodeKey

      public AsymmetricKey setNodeKey(AsymmetricKey k)

      Setting the current node key.

      Parameters:
      k - the new node key
      Returns:
      the previously set node key
    • getNodeKey

      public AsymmetricKey getNodeKey()

      Getting the currently set node key.

      Returns:
      the currently set node key
    • parse

      protected final void parse(org.bouncycastle.asn1.ASN1Encodable p) throws IOException
      Specified by:
      parse in class AbstractBlock
      Throws:
      IOException
    • toAsn1Object

      public org.bouncycastle.asn1.ASN1Object toAsn1Object(DumpType dumpType) throws IOException
      Description copied from interface: Dumpable

      Dumps an ASN.1 representation of the object.

      Specified by:
      toAsn1Object in interface Dumpable
      Parameters:
      dumpType - the dump type to be used
      Returns:
      the ASN.1 string representation of the object
      Throws:
      IOException - if dumping of the object fails due to an illegal internal state of the object
    • dumpValueNotation

      public String dumpValueNotation(String prefix, DumpType dumpType) throws IOException
      Specified by:
      dumpValueNotation in interface Block
      Throws:
      IOException
    • getUrl

      public String getUrl() throws IOException

      Gets an URL representation of the identity.

      Returns:
      the url or IdentityStoreBlock.UNENCODABLE on fail
      Throws:
      IOException - on failure
    • getType

      Getting the type of identity this key reflects.

      If the type has not been set this methode assumes for a public/private keypair a node key.

      Returns:
      the type of identity
    • equals

      public boolean equals(Object t)
      Overrides:
      equals in class Object