Interface
Version : 1.0 / Update : 2025.10.14
1. Overview
This document defines the user interface of the JWT HTTP REST API Service. The JWT HTTP REST API Service provides an HTTP-based RESTful API.
For authentication, the JWT HTTP REST API Service supports two authentication methods
TLS Authentication (HTTPS): Depending on the configuration, it supports no authentication, server authentication, or mutual authentication.
API Authentication: Used to authenticate the client accessing the service.
2. Configuration File
2-1. Program Execution Options
The JWT REST API Service looks for the config.json file in the same directory where the program is executed. If you want to specify a different location for the config.json file, you can use the -config execution parameter when starting the program.
Program Execution Examples
% key4cJWTServer -config /opt/key4c/etc/config.jsonTo check the program version, run it with the -version option. This will display the current version of the program.
Example: Checking Program Version
% key4cJWTServer -version
key4cJWTServer Version 1.0.02-2. Configuration File
The configuration file used by the program follows the structure shown below.
server
ip
Required
IP addresses allowed to access the JWT service (set to "" to allow all)
port
Required
Port used by the JWT service
tlsOptions
tlsType
Required
HTTP Security Option for the JWT Service Valid Values:
0: No TLS
1: TLS (Server Only)
2: Mutual TLS (Client & Server)
If this option is set to 1 or 2, the fields caCertFile, certFile, and keyFile in the same layer must be provided.
caCertFile
Conditionally Required
Refer to the tlsType description.
certFile
Conditionally Required
Refer to the tlsType description.
keyFile
Conditionally Required
Refer to the tlsType description.
key4c
uuid
Required
UUID of the HSM token as shown in the Key4C web console
pin
Required
PIN used to access the HSM
apiKey
Required
apiKey for using the Key4C service
jwt
issuer
Required
Value to be used as the JWT issuer (e.g., iss)
appConfig
logFile
Optional
If empty, output is written to stdout only
Example Configuration File
3. Interface
3-1. Common HTTP Headers
Content-Type
Application/json
Mandatory
All request and response data are formatted in JSON.
3-2. JWT Signing Request
Request
Request
ckaId
string
Mandatory
CKA_ID value of the key used for JWT.
signAlg
string
Conditional
For RSA keys, the signAlg parameter must be specified.
Available values:
RSA,RSA-PSS
For ECC keys, the signAlg value is fixed.
Fixed value :
ECC
hash
string
Conditional
For RSA keys, one of the following three hash algorithms must be selected and provided:
sha256,sha384,sha512
For ECC keys, the hash algorithm follows the key configuration, and any input value is ignored.
prime256v1 (P-256)→sha256
subject
string
Mandatory
The subject name that will use the JWT.
aliveHours
integer
Mandatory
JWT token validity period in hours. Default = 0.
aliveMinutes
integer
Mandatory
JWT token validity period in minutes. Default = 0.
alibeSeconds
integer
Mandatory
JWT token validity period in seconds. Default = 0.
claims
map
Optional
Key-value map containing JWT claims.
Request Body Example
Response Body
time
date
Mandatory
GTM+9 date time string
code
integer
Mandatory
- 0: success - 1: invalid parameters - 2: server error
message
string
Mandatory
error message
token
string
Optional
when code is 0, token will returns JWT token
Response Body Example
3-3. JWT Public Key Request
Request
Request Example
Response Body
time
date
Mandatory
GTM+9 date time string
code
integer
Mandatory
- 0: success - 1: invalid parameters - 2: server error
message
string
Mandatory
error message
publicKey
string
Optional
when code is 0, publicKey will returns Public Key
Response Body Example
4. JWT
4-1. JWT Structure
Header
Algorithm, type
alg, typ
Payload
Data
exp, iss, iat, nbf, sub, claims
Do not include sensitive information
Signature
Tamper prevention
Signature value
Value obtained by signing base64(header) + '.' + base64(payload) with a private key
Decoded header Example
alg
Token signing algorithm (RS256: RSA + SHA256, PS256: RSA-PSS + SHA256, ES256: ECC + SHA256)
typ
Token type
Decoded payload Example
exp
Token expiration time
iat
Token issued-at time
nbf
Token not-before time
iss
Token issuer
sub
Token subject
Others
User-defined data