Class PemObject

java.lang.Object
org.bouncycastle.util.io.pem.PemObject
org.cryptacular.pem.PemObject
All Implemented Interfaces:
org.bouncycastle.util.io.pem.PemObjectGenerator

public final class PemObject extends org.bouncycastle.util.io.pem.PemObject
Container for PEM encoded data.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final Descriptor
    Descriptor for this PEM object which includes the RFC governing its format and other relevant data about the data.
  • Constructor Summary

    Constructors
    Constructor
    Description
    PemObject(Descriptor descriptorParam, byte[] content)
    Generic constructor for object without headers.
    PemObject(Descriptor descriptorParam, List<org.bouncycastle.util.io.pem.PemHeader> headers, byte[] content)
    Generic constructor for object with headers.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    assertHeadersValid(List<org.bouncycastle.util.io.pem.PemHeader> headers)
    Throws an exception if the headers are not according to their governing RFC format.
    private void
    assertPemHeaderValid(List<org.bouncycastle.util.io.pem.PemHeader> headers, Set<String> specifiers, Format format, boolean allowX, boolean disregardX)
    Checks to make sure a given list of PemHeader instances the names specified are valid.
    static PemObject
    decode(byte[] encoded)
    Decodes the supplied bytes into a PemObject.
    Returns descriptor on PEM object

    Methods inherited from class org.bouncycastle.util.io.pem.PemObject

    generate, getContent, getHeaders, getType

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • descriptor

      private final Descriptor descriptor
      Descriptor for this PEM object which includes the RFC governing its format and other relevant data about the data.
  • Constructor Details

    • PemObject

      public PemObject(Descriptor descriptorParam, byte[] content)
      Generic constructor for object without headers.
      Parameters:
      descriptorParam - Descriptor on the content (i.e. RFC governing PEM format, type etc.)
      content - The binary content of the object.
    • PemObject

      public PemObject(Descriptor descriptorParam, List<org.bouncycastle.util.io.pem.PemHeader> headers, byte[] content)
      Generic constructor for object with headers.
      Parameters:
      descriptorParam - Descriptor on the content (i.e. RFC governing PEM format, type etc.)
      headers - A list of PemHeader objects.
      content - The binary content of the object.
  • Method Details

    • decode

      public static PemObject decode(byte[] encoded) throws EncodingException
      Decodes the supplied bytes into a PemObject.
      Parameters:
      encoded - to decode
      Returns:
      PEM object
      Throws:
      EncodingException - if the bytes cannot be decoded
    • getDescriptor

      public Descriptor getDescriptor()
      Returns descriptor on PEM object
      Returns:
      Descriptor
    • assertHeadersValid

      private void assertHeadersValid(List<org.bouncycastle.util.io.pem.PemHeader> headers)
      Throws an exception if the headers are not according to their governing RFC format.
      Parameters:
      headers - headers
    • assertPemHeaderValid

      private void assertPemHeaderValid(List<org.bouncycastle.util.io.pem.PemHeader> headers, Set<String> specifiers, Format format, boolean allowX, boolean disregardX) throws IllegalArgumentException
      Checks to make sure a given list of PemHeader instances the names specified are valid.
      Parameters:
      headers - headers
      specifiers - Set of allowed specifiers/headers
      format - RFC format
      allowX - Allow specifiers/headers starting with X-
      disregardX - Treat specifiers/headers starting with X- as if they do not
      Throws:
      IllegalArgumentException - If header element in the headers list is not valid