Package org.jboss.resteasy.jose.jws.util

## Class PemUtils

- java.lang.Object
- - org.jboss.resteasy.jose.jws.util.PemUtils

-     public final class PemUtils
      extends Object

  Utility classes to extract PublicKey, PrivateKey, and X509Certificate from openssl generated PEM files
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static X509Certificate` | `decodeCertificate​(String cert)` | Decode a X509 Certificate from a PEM string
    `static PrivateKey` | `decodePrivateKey​(String pem)` | Decode a Private Key from a PEM string
    `static PublicKey` | `decodePublicKey​(String pem)` | Decode a Public Key from a PEM string
    `static String` | `encodeCertificate​(Certificate certificate)` | Encode a X509 Certificate to a PEM string
    `static String` | `encodeKey​(Key key)` | Encode a Key to a PEM string
    `static String` | `generateThumbprint​(String[] certChain, String encoding)` |
    `static byte[]` | `pemToDer​(String pem)` |
    `static String` | `removeBeginEnd​(String pem)` |

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

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

- - ### Method Detail

    - #### decodeCertificate

          public static X509Certificate decodeCertificate​(String cert)

      Decode a X509 Certificate from a PEM string
      Parameters:
        `cert` -
      Returns:
      Throws:
        `Exception`

    - #### decodePublicKey

          public static PublicKey decodePublicKey​(String pem)

      Decode a Public Key from a PEM string
      Parameters:
        `pem` -
      Returns:
      Throws:
        `Exception`

    - #### decodePrivateKey

          public static PrivateKey decodePrivateKey​(String pem)

      Decode a Private Key from a PEM string
      Parameters:
        `pem` -
      Returns:
      Throws:
        `Exception`

    - #### encodeKey

          public static String encodeKey​(Key key)

      Encode a Key to a PEM string
      Parameters:
        `key` -
      Returns:
      Throws:
        `Exception`

    - #### encodeCertificate

          public static String encodeCertificate​(Certificate certificate)

      Encode a X509 Certificate to a PEM string
      Parameters:
        `certificate` -
      Returns:

    - #### pemToDer

          public static byte[] pemToDer​(String pem)

    - #### removeBeginEnd

          public static String removeBeginEnd​(String pem)

    - #### generateThumbprint

          public static String generateThumbprint​(String[] certChain,
                                                  String encoding)
                                           throws NoSuchAlgorithmException

      Throws:
        `NoSuchAlgorithmException`