org.keycloak.common.util

## Class DerUtils

- java.lang.Object
- - org.keycloak.common.util.DerUtils

-     public final class DerUtils
      extends Object

  Extract PrivateKey, PublicKey, and X509Certificate from a DER encoded byte array or file. Usually generated from openssl
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static X509Certificate` | `decodeCertificate(InputStream is)`
    `static PrivateKey` | `decodePrivateKey(byte[] der)`
    `static PrivateKey` | `decodePrivateKey(InputStream is)`
    `static PublicKey` | `decodePublicKey(byte[] der)`

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

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

- - ### Method Detail

    - #### decodePrivateKey

          public static PrivateKey decodePrivateKey(InputStream is)
                                             throws Exception

      Throws:
        `Exception`

    - #### decodePublicKey

          public static PublicKey decodePublicKey(byte[] der)
                                           throws NoSuchAlgorithmException,
                                                  InvalidKeySpecException,
                                                  NoSuchProviderException

      Throws:
        `NoSuchAlgorithmException`
        `InvalidKeySpecException`
        `NoSuchProviderException`

    - #### decodeCertificate

          public static X509Certificate decodeCertificate(InputStream is)
                                                   throws Exception

      Throws:
        `Exception`

    - #### decodePrivateKey

          public static PrivateKey decodePrivateKey(byte[] der)
                                             throws NoSuchAlgorithmException,
                                                    InvalidKeySpecException,
                                                    NoSuchProviderException

      Throws:
        `NoSuchAlgorithmException`
        `InvalidKeySpecException`
        `NoSuchProviderException`

Copyright © 2021 JBoss by Red Hat. All rights reserved.