Package net.dona.doip.util.tls

## Class X509CertificateGenerator

- java.lang.Object
- - net.dona.doip.util.tls.X509CertificateGenerator

-     public class X509CertificateGenerator
      extends java.lang.Object

  Utility methods to generate X509 certificates, and to read and write certificates from and to PEM files.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `X509CertificateGenerator()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static java.security.cert.X509Certificate` | `generate​(java.lang.String handle, int index, java.security.PublicKey pubKey, java.security.PrivateKey privKey)` |
    `static java.security.cert.X509Certificate` | `generate​(java.lang.String handle, java.security.PublicKey pubKey, java.security.PrivateKey privKey)` |
    `static java.security.cert.X509Certificate` | `generateWithCnAndUid​(java.lang.String cn, java.lang.String uid, java.security.PublicKey pubKey, java.security.PrivateKey privKey)` |
    `static java.security.cert.X509Certificate` | `generateWithUid​(java.lang.String uid, java.security.PublicKey pubKey, java.security.PrivateKey privKey)` |
    `static java.security.cert.X509Certificate` | `readCertAsPem​(java.io.Reader reader)` |
    `static java.security.cert.X509Certificate[]` | `readCertChainAsPem​(java.io.Reader reader)` |
    `static void` | `storeCertAndKey​(java.security.KeyStore keyStore, java.security.cert.Certificate cert, java.security.PrivateKey privKey, java.lang.String alias, java.lang.String keyPass)` |
    `static void` | `writeCertAsPem​(java.io.Writer writer, java.security.cert.Certificate cert)` |

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

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

- - ### Constructor Detail

    - #### X509CertificateGenerator

          public X509CertificateGenerator()

  - ### Method Detail

    - #### generate

          public static java.security.cert.X509Certificate generate​(java.lang.String handle,
                                                                    java.security.PublicKey pubKey,
                                                                    java.security.PrivateKey privKey)
                                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### generate

          public static java.security.cert.X509Certificate generate​(java.lang.String handle,
                                                                    int index,
                                                                    java.security.PublicKey pubKey,
                                                                    java.security.PrivateKey privKey)
                                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### generateWithUid

          public static java.security.cert.X509Certificate generateWithUid​(java.lang.String uid,
                                                                           java.security.PublicKey pubKey,
                                                                           java.security.PrivateKey privKey)
                                                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### generateWithCnAndUid

          public static java.security.cert.X509Certificate generateWithCnAndUid​(java.lang.String cn,
                                                                                java.lang.String uid,
                                                                                java.security.PublicKey pubKey,
                                                                                java.security.PrivateKey privKey)
                                                                         throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### storeCertAndKey

          public static void storeCertAndKey​(java.security.KeyStore keyStore,
                                             java.security.cert.Certificate cert,
                                             java.security.PrivateKey privKey,
                                             java.lang.String alias,
                                             java.lang.String keyPass)
                                      throws java.security.KeyStoreException

      Throws:
        `java.security.KeyStoreException`

    - #### writeCertAsPem

          public static void writeCertAsPem​(java.io.Writer writer,
                                            java.security.cert.Certificate cert)
                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readCertAsPem

          public static java.security.cert.X509Certificate readCertAsPem​(java.io.Reader reader)
                                                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### readCertChainAsPem

          public static java.security.cert.X509Certificate[] readCertChainAsPem​(java.io.Reader reader)
                                                                         throws java.io.IOException

      Throws:
        `java.io.IOException`