PemObject (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.util.io.pem

## Class PemObject

- java.lang.Object
- - org.bouncycastle.util.io.pem.PemObject

- All Implemented Interfaces:
    PemObjectGenerator

      public class PemObject
      extends java.lang.Object
      implements PemObjectGenerator

  A generic PEM object - type, header properties, and byte content.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `PemObject(java.lang.String type, byte[] content)` Generic constructor for object without headers.
    `PemObject(java.lang.String type, java.util.List headers, byte[] content)` Generic constructor for object with headers.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `PemObject` | `generate()` Generate a PEM object.
    `byte[]` | `getContent()`
    `java.util.List` | `getHeaders()`
    `java.lang.String` | `getType()`

    - ### Methods inherited from class java.lang.Object

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

- - ### Constructor Detail

    - #### PemObject

          public PemObject(java.lang.String type,
                           byte[] content)

      Generic constructor for object without headers.
      Parameters:
        `type` - pem object type.
        `content` - the binary content of the object.

    - #### PemObject

          public PemObject(java.lang.String type,
                           java.util.List headers,
                           byte[] content)

      Generic constructor for object with headers.
      Parameters:
        `type` - pem object type.
        `headers` - a list of PemHeader objects.
        `content` - the binary content of the object.

  - ### Method Detail

    - #### getType

          public java.lang.String getType()

    - #### getHeaders

          public java.util.List getHeaders()

    - #### getContent

          public byte[] getContent()

    - #### generate

          public PemObject generate()
                             throws PemGenerationException

      Description copied from interface: `PemObjectGenerator`
      Generate a PEM object.
      Specified by:
        `generate` in interface `PemObjectGenerator`
      Returns:
        the generated object.
      Throws:
        `PemGenerationException` - on failure.