![]() |
REST API
16
REST API for Luna Network HSMs
|
Generates a certificate signing request for the webserver's certificate.
Users with the following role privileges can perform this command:
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
minLength: 1
maxLength: 64
pattern: ^[a-zA-Z0-9]{1,64}$
keyType is the type of key that will be configured as part of the certificate signing request.
Use: Required
JSON Schema:
Object type: string minLength: 3 maxLength: 3 pattern: ^(rsa|ecc)$
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: integer
cn is the common name that will be configured as part of the certificate signing request.
Use: Required
JSON Schema:
Object type: string minLength: 1 maxLength: 64 pattern: ^[a-zA-Z0-9 '()+,.\/:=?-]*$
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
minLength: 2
maxLength: 2
pattern: ^(A-Z){2}
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
minLength: 1
maxLength: 64
pattern: ^[a-zA-Z][a-zA-Z0-9_]{0,63}$
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
minLength: 1
maxLength: 64
pattern: ^[a-zA-Z][a-zA-Z0-9_.-]{0,63}$
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
minLength: 1
maxLength: 64
pattern: ^[a-zA-Z][a-zA-Z0-9_]{0,63}$
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
minLength: 1
maxLength: 64
pattern: ^[a-zA-Z][a-zA-Z0-9_]{0,63}$
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 minLength: 3 maxLength: 128 Pattern: ^(\w+)(\.|_)?(\w*)@(\w+)(\.(\w+))+$
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
minLength: 1
maxLength: 64
pattern: ^([a-zA-Z0-9_.-]{0,63}){1,10}(,[a-zA-Z0-9_.-]{0,63}){0,10}$
startDate is the starting date that will be configured as part of the certificate signing request.
Use: Not Required
JSON Schema:
Object
type: string
pattern: ^\d{4}-[0-1]{1}\d{1}-[0-3]{1}\d{1}$
days is the duration that will be configured as part of the certificate signing request.
Use: Not Required
JSON Schema:
Object type: integer minValue: 1 maxValue: 3653
Data buffer containing the file contents.
We failed to parse your 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
}
{
}
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()