REST API  14
REST API for Luna Network HSMs
POST /api/lunasa/webServer/csr

POST /api/lunasa/webServer/csr

Generates a certificate signing request for the webserver's certificate.

Parameters

curveName

curveName is the elliptic curve used for an ECDSA-based certificate that will be configured as part of the certificate signing request.

Use: Not Required

JSON Schema:

   Object
   type: string

keyType

keyType is the type of key that will be configured as part of the certificate signing request.

Use: Required

JSON Schema:

   Object
   type: string

keySize

keySize is the number of bits for the key that will be configured as part of the certificate signing request.

Use: Required

JSON Schema:

   Object
   type: int

cn

cn is the common name that will be configured as part of the certificate signing request.

Use: Required

JSON Schema:

   Object
   type: string

country

country is the country that will be configured as part of the certificate signing request's subject.

Use: Not Required

JSON Schema:

   Object
   type: string

state

state is the state that will be configured as part of the certificate signing request's subject.

Use: Not Required

JSON Schema:

   Object
   type: string

location

location is the location that will be configured as part of the certificate signing request's subject.

Use: Not Required

JSON Schema:

   Object
   type: string

organization

organization is the organization that will be configured as part of the certificate signing request's subject.

Use: Not Required

JSON Schema:

   Object
   type: string

orgunit

orgunit is the organization unit that will be configured as part of the certificate signing request's subject.

Use: Not Required

JSON Schema:

   Object
   type: string

email

email is the email that will be configured as part of the certificate signing request's subject.

Use: Not Required

JSON Schema:

   Object
   type: string

subjectAltNames

subjectAltName is the array of alternate names that will be configured as part of the certificate signing request's subject.

Use: Not Required

JSON Schema:

   Object
   type: array
      subjectAltName: Obect
      type: string

startDate

startDate is the starting date that will be configured as part of the certificate signing request.

Use: Not Required

JSON Schema:

   Object
   type: string

days

days is the duration that will be configured as part of the certificate signing request.

Use: Not Required

JSON Schema:

   Object
   type: string

Responses

200

Data buffer containing the file contents.

400

Unexpected error

Example Request

   POST
   https://1.2.3.4:8443/api/lunasa/webServer/csr

   {
   "keyType" : "rsa",
   "keySize" : 2048,
   "subjectAltNames" : ["example.com", "www.example.com"],
   "cn" : "1.2.3.4",
   "startDate" : "2020-11-20",
   "days" : 365
   }

Example Result

{
  
}

Notes

This resource returns the contents of a file in a buffer.

Below is an example of getting the contents in python. We iterate through the contents and save them to a file.

        r = requests.post("/api/lunasa/webServer/csr",
                         stream=True,
                         cookies=cookies,
                         verify=False,
                         allow_redirects=False,
                         data=payload)

        with open("ssl.csr", 'wb') as csr:
          for chunk in r.iter_content(chunk_size=1024):
              if chunk:
                  csr.write(chunk)
          csr.close()