Class AbstractBlock

java.lang.Object
net.messagevortex.asn1.AbstractBlock
All Implemented Interfaces:
Block, Dumpable
Direct Known Subclasses:
AlgorithmParameter, AsymmetricAlgorithmSpec, BlendingParameter, BlendingSpec, CipherSpec, HeaderRequest, HeaderRequestFactory, IdentityBlock, IdentityStore, IdentityStoreBlock, InnerMessageBlock, Key, MacAlgorithm, Operation, PayloadChunk, PrefixBlock, ReplyBlock, RoutingCombo, SizeBlock, UsagePeriod, VortexMessage

public abstract class AbstractBlock extends Object implements Block
Abstract class collecting all ASN1 Block parser classes.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    Decode a base64 encoded string representation to a byte array.
    static byte[]
    Converts the values of a given String to a byte array.
    protected void
    parse(byte[] b)
     
    protected abstract void
    parse(org.bouncycastle.asn1.ASN1Encodable to)
     
    protected String
     
    static String
    toBase64(byte[] b)
    Get a base64 encoded string representation of the byte array.
    static String
    toBitString(org.bouncycastle.asn1.ASN1BitString bs)
    Convert an ASN.1 Bit String to the respective string representation.
    byte[]
    toBytes(DumpType dumpType)
    Dumps the object as ASN.1 der encoded byte array.
    protected static byte[]
    toDer(org.bouncycastle.asn1.ASN1Object a)
     
    static String
    toHex(byte[] data)
    Converts a byte array to a hex representation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.messagevortex.asn1.Block

    dumpValueNotation

    Methods inherited from interface net.messagevortex.asn1.Dumpable

    toAsn1Object
  • Field Details

  • Constructor Details

    • AbstractBlock

      public AbstractBlock()
  • Method Details

    • fromHex

      public static byte[] fromHex(String s)

      Converts the values of a given String to a byte array.

      Parameters:
      s - the string to be converted containing hex digits
      Returns:
      the resulting byte array
    • fromBase64

      public static byte[] fromBase64(String b)

      Decode a base64 encoded string representation to a byte array.

      Parameters:
      b - the string to be decoded
      Returns:
      the decoded equivalent
    • toBase64

      public static String toBase64(byte[] b)

      Get a base64 encoded string representation of the byte array.

      Parameters:
      b - the byte array to be encoded
      Returns:
      the encoded equivalent
    • toHex

      public static String toHex(byte[] data)

      Converts a byte array to a hex representation.

      Parameters:
      data - the byte array to be converted to hex
      Returns:
      the resuting hex string
    • toBitString

      public static String toBitString(org.bouncycastle.asn1.ASN1BitString bs)

      Convert an ASN.1 Bit String to the respective string representation.

      Parameters:
      bs - The BitString to be represented
      Returns:
      the resulting string.
    • parse

      protected void parse(byte[] b) throws IOException
      Throws:
      IOException
    • parse

      protected abstract void parse(org.bouncycastle.asn1.ASN1Encodable to) throws IOException
      Throws:
      IOException
    • toDer

      protected static byte[] toDer(org.bouncycastle.asn1.ASN1Object a)
    • toBytes

      public byte[] toBytes(DumpType dumpType) throws IOException

      Dumps the object as ASN.1 der encoded byte array.

      Specified by:
      toBytes in interface Block
      Parameters:
      dumpType - the dump type to be used (@see DumpType)
      Returns:
      the der encoded byte array
      Throws:
      IOException - if encoding was unsuccessful
    • prepareDump

      protected String prepareDump(String s)