Interface PEMParser


  • public interface PEMParser

    Implementations of this interface provide the functionality for parsing PEM format.

    Usually, an instance of this interface is obtained by using a factory method of PEMParsers.

    WARNING:

    Implementations of this interface are intended to parse PEM-encoded texts originated from trusted sources(e.g. a PEM file created by yourself). Be careful if you parse data originated from untrusted sources.

    Thread Safety:

    Depends on implementations. See PEMParsers.

    Author:
    Tomoki Sato
    See Also:
    PEMParsers
    • Field Detail

      • BEGIN_ENCAPSULATION_BOUNDARIES_FMR

        static final String BEGIN_ENCAPSULATION_BOUNDARIES_FMR
        The format string used to make a pre-encapsulation boundary.
        See Also:
        Constant Field Values
      • END_ENCAPSULATION_BOUNDARIES_FMR

        static final String END_ENCAPSULATION_BOUNDARIES_FMR
        The format string used to make a post-encapsulation boundary.
        See Also:
        Constant Field Values
      • PKCS8_PRIVATE_KEY_LABEL

        static final String PKCS8_PRIVATE_KEY_LABEL
        The type label in an encapsulation boundary indicating that the content is a PKCS #8 Private Key Info.
        See Also:
        Constant Field Values
      • SUBJECT_PUBLIC_KEY_INFO_LABEL

        static final String SUBJECT_PUBLIC_KEY_INFO_LABEL
        The type label in an encapsulation boundary indicating that the content is a Subject Public Key Info.
        See Also:
        Constant Field Values
    • Method Detail

      • parse

        byte[] parse​(String pemText)
        Parses the given PEM-encoded text and extracts its content.
        Parameters:
        pemText - a PEM-encoded text
        Returns:
        the content extracted from the given PEM-encoded text.
        Throws:
        MalformedPEMException - if the given text cannot be parsed as a valid PEM format.