Class CertificateCommand

java.lang.Object
org.codice.ddf.security.certificate.generator.CertificateCommand

public class CertificateCommand extends Object
  • Method Details

    • main

      public static void main(String[] args)
      Pass in a string to use as the common name of the certificate to be generated. Exception thrown if 0 arguments or more than 2 argument (or more than 4 when -san is used).
       Arguments to this program are: (-cn <cn>|-dn <dn>) [-san <tag:name,tag:name,...>]
      
       where:
       <cn> represents a fully qualified common name (e.g. "<FQDN>", where <FQDN> could be something like cluster.yoyo.com)
       <dn> represents a distinguished name as a comma-delimited string (e.g. "c=US, st=California, o=Yoyodyne, l=San Narciso, cn=<FQDN>")
       <tag:name,tag:name,...> represents optional subject alternative names to be added to the generated certificate
          (e.g. "DNS:<FQDN>,DNS:node1.<FQDN>,DNS:node2.<FQDN>"). The format for subject alternative names
          is similar to the OpenSSL X509 configuration format. Supported tags are:
            email - email subject
            URI - uniformed resource identifier
            RID - registered id
            DNS - hostname
            IP - ip address (V4 or V6)
            dirName - directory name
       
      Parameters:
      args - arguments to the certificate program (see above for description)
    • configureDemoCert

      public static String configureDemoCert(String commonName)
      Generates new signed certificate. The input parameter is used as the certificate's common name.

      Postcondition is the server keystore is updated to include a private entry. The private entry has the new certificate chain that connects the server to the Demo CA. The matching private key is also stored in the entry.

      Parameters:
      commonName - string to use as the common name in the new certificate.
      Returns:
      the string used as the common name in the new certificate
    • configureDemoCert

      public static String configureDemoCert(String commonName, @Nullable String[] subjectAltNames)
      Generates new signed certificate. The input parameter is used as the certificate's common name and optional subject alternative names.

      Postcondition is the server keystore is updated to include a private entry. The private entry has the new certificate chain that connects the server to the Demo CA. The matching private key is also stored in the entry.

      Parameters:
      commonName - string to use as the common name in the new certificate.
      subjectAltNames - names in the form tag:name (format similar to OpenSSL X509 configuration)
      Returns:
      the string used as the common name in the new certificate
    • configureDemoCertWithDN

      public static String configureDemoCertWithDN(String[] dn)
      Generates new signed certificate. The input parameter is the full set of attributes of the distinguished name for the cert. It must include a single CN value for the common name.

      Postcondition is the server keystore is updated to include a private entry. The private entry has the new certificate chain that connects the server to the Demo CA. The matching private key is also stored in the entry.

      Parameters:
      dn - String params in the form attrKey=attrVal composing a distinguished name. e.g. {@code configureDemoCertWithDN(new String[] {"cn=John Whorfin", "o=Yoyodyne", "l=San Narciso", "st=California", "c=US")} @return the string used as the common name in the new certificate
    • configureDemoCertWithDN

      public static String configureDemoCertWithDN(String[] dn, @Nullable String[] subjectAltNames)
      Generates new signed certificate. The input parameter is the full set of attributes of the distinguished name for the cert and optional subject alternative names. It must include a single CN value for the common name.

      Postcondition is the server keystore is updated to include a private entry. The private entry has the new certificate chain that connects the server to the Demo CA. The matching private key is also stored in the entry.

      Parameters:
      dn - String params in the form attrKey=attrVal composing a distinguished name. e.g. {@code configureDemoCertWithDN(new String[] {"cn=John Whorfin", "o=Yoyodyne", "l=San Narciso", "st=California", "c=US"), null} @param subjectAltNames names in the form {@code tag:name} (format similar to OpenSSL X509 configuration) @return the string used as the common name in the new certificate
    • getKeyStoreFile

      protected static KeyStoreFile getKeyStoreFile()