REST Interface
The following covers information on the SignServer REST Interface.
API Overview
The SignServer REST Interface supports integration with SignServer over a RESTful Web Service.
In this initial version the API is limited to one flavor of the client operation for submitting a process (signing) request to SignServer. This is a more modern and RESTful alternative to the Client WS Interface and the Client HTTP Interface.
In future versions, the interface may be extended to support additional API calls from the other interfaces and/or add new ones.
Getting Started
The SignServer REST interface is described using the OpenAPI Specification (OAS). The OpenAPI Specification is a community-driven specification for describing REST APIs.
OpenAPI documents describe API services and are represented in YAML or JSON formats. These documents may be produced and served statically or generated dynamically from an application.
OpenAPI Document
The interface is documented in an OpenAPI document in YAML or JSON formats:
Document | JSON | YAML |
---|---|---|
SignServer REST Interface 1.2.1 | openapi.json | openapi.yaml |
Alternatively, you can also generate the document from a server running SignServer assuming that is enabled and supported by the application server.
Enabling MicroProfile OpenAPI in WildFly
Using JBoss CLI, enable the extension and subsystem, and then restart the application server:
/extension=org.wildfly.extension.microprofile.openapi-smallrye:add()
/subsystem=microprofile-openapi-smallrye:add()
reload
After restarting the application server and deploying SignServer, the OpenAPI document can be obtained from /signserver/openapi (for YAML format) or /signserver/openapi?format=JSON (for JSON format).
Integrating with the REST API
Resources
The SignServer REST API provides the following resource:
/rest/v1/workers
Methods
Each request requires a specified HTTP method.
Note that a numeric value for [idOrName] is treated by SignServer as a WorkerID. If the {idOrName} value is not numeric, SignServer will take it as a WorkerID.
Method | URL | Request Media Type | Request parameters | Response Media Type |
---|---|---|---|---|
POST | /rest/v1/workers/{idOrName}/process | application/json | data, metadata, encoding | application/json |
Custom Header requires
The admin operations of the SignServer REST API requires a custom header called "X-Keyfactor-Requested-With" to accept the request. This protects SignServer REST endpoints from being maliciously invoked from administrator machines by clickjacking or CSRF methods.
Examples
The following provides examples of how to use the SignServer REST API.
Example - Sign Text with CMS Signer
The following provides an example of signing a sample text with the CMS Signer using the JSON request media type. This example assumes that you have a SignServer CMS Signer set up in SignServer.
Send a request to the CMS Signer using the worker name CMSSigner and use a JSON media type for sending the request in the body. The response is in JSON format and contains archiveId, data, requestId, and the signer certificate.
URL:
http:
//localhost:8080/signserver/rest/v1/workers/CMSSigner/process
Request Body:
{
"metaData"
: {
"additionalProp1"
:
"value1"
,
"additionalProp2"
:
"value2"
,
"additionalProp3"
:
"value3"
},
"data"
:
"Sample Data!"
}
Response:
{ "archiveId": "bd83996d12787f6b11531b219c236803ea16ffd9", "data": "MIAGCSqGSIb3DQEHAqCAMIACAQExDTALBglghkgBZQMEAgEwgAYJKoZIhvcNAQcBoIAkgAQMU2FtcGxlIERhdGEhAAAAAAAAoIAwggOXMIICf6ADAgECAgg509sSVBsmFzANBgkqhkiG9w0BAQsFADBMMRYwFAYDVQQDDA1EU1MgU3ViIENBIDExMRAwDgYDVQQLDAdUZXN0aW5nMRMwEQYDVQQKDApTaWduU2VydmVyMQswCQYDVQQGEwJTRTAeFw0xNjAzMDMwODI1MDRaFw0zNjAyMjcwODI1MDRaMEoxFDASBgNVBAMMC3NpZ25lcjAwMDAzMRAwDgYDVQQLDAdUZXN0aW5nMRMwEQYDVQQKDApTaWduU2VydmVyMQswCQYDVQQGEwJTRTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALIUqrDCIdLajg87fOi+oL6Ma4gQueNrWICWD+HKtGnbyYXoE4ZVooTpnNtAgyaYgJHP4R6pc3VbyDIISHpPao3dC9dMAX2autQjeEbhef8Nq+CyWfyxpETTO3jnLLjt0+rlih9glZYh1b/qqyyJf4Clw+q2EJB+SCtpRJqBL9F6rLRZP8DaXAqHXjsYH34zGGF6yRAg9opBqw6kju8Z/N7L4aeQc+x9TbWKtLacLy7O/qF3QbqE1hQSYm0iH3/lZ5sygyIYWrWzJ1O1mnukmKV8/LGsCQdcTAxQQQxxWUT8hIKgoy22csxRP8XTRwd6xTgPbI2XqBxKOkyPhD+IX6ECAwEAAaN/MH0wHQYDVR0OBBYEFDb9Zjcufu11SYOtPK+29JnAGDxjMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUHGBBSt6YreXWA4ro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