The EST Client is a completely self-contained EST client example application. This supports automatic enrollment in EJBCA Client Mode, as well as EJBCA in RA Mode. As the application target is IoT devices requiring On Device Key Generation (the safest mode), not all EST specific functions are implemented.
EJBCA-EE v6.11 or greater.
EJBCA-CE does not implement the EST protocol.
EST Endpoint | EJBCA-EE | EJBCA-CE |
---|---|---|
Supports /cacerts | ✓ | - |
Supports /simpleenroll | ✓ | - |
Supports /simplereenroll | ✓ | - |
Supports /fullcmc | - | - |
Supports /serverkeygen | - | - |
Supports /csrattrs | - | - |
Alias Mode | Username | Authentication | Client |
---|---|---|---|
Client Mode | Extract from DN | Extract from DN | Use subject switch |
Client Mode | Extract from DN | Extract from DN | Use eeuser, eekey, eepass switches |
Client Mode | Extract from DN | challengePwd in CSR | Use eeuser and challengepass switches |
Client Mode | Extract from DN | challengePwd in CSR | Use eeuser and subject swtiches |
Client Mode | Extract from DN | Basic Auth HTTPS | Use username, password, and eeuser switches |
Client Mode | Extract from DN | Basic Auth HTTPS | Use username, password, and subject switches |
Client Mode | Extract from DN | Vendor Certificate Auth not allowing name change | Use subject, birthcert, birthkey, birthkeypass switches |
RA Mode | Extract from DN | Basic Auth HTTPS PSK | Use username, password, and subject switches |
- Grabs the EST Aliases certificate chain from /cacerts
- Converts the PKCS7 chain into an x.509 PEM file & saves to the file system.
- Creates a new keypair (Kpriv and Kpub)
- Creates a CSR for EJBCA running in Client Mode (enrollmentcode or vendor mode)
- Submits the CSR to EJBCA
- Converts the PKCS7 file into an x.509 PEM file & saves to the file system.
- Saves Kpriv to the file system.
- Creates a new keypair (Kpriv and Kpub)
- Creates a CSR for submittal to the EST Alias endpoint
- Uses mTLS with the existing certificate to submit the new CSR to EJBCA
- Converts the returned PKCS7 file into an x.509 PEM file & saves that to the file system [backing up the old cert].
- Save the new Kpriv to the file system [backing up the old key].
sudo apt update
sudo apt install -y build-essential git libcurl4-gnutls-dev curl libssl-dev
cd ~
git clone https://github.com/Keyfactor/keyfactor-c-estclient.git
cd keyfactor-c-estclient
make
sudo dnf update -y
sudo dnf groupinstall -y "Development Tools"
sudo dnf install -y curl-devel curl openssl-devel
cd ~
git clone https://github.com/Keyfactor/keyfactor-c-estclient.git
cd keyfactor-c-estclient
make
What follows is an example of a re-enrollment call. In EST, the last issued certificate is used to authenticate the client before issuing a new Certificate. After this example, we see how to set up EJBCA for different initial enrollment types.
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-ra-mode \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--keytype RSA --keysize 2048 \
--subject "CN=EST_Device_RA_1,OU=IoT Strategy,O=Keyfactor" \
--username est_device --password est_password \
--reenroll
Implicitly set username:enrollmentcode in subject
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-client-user-pass \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--subject "CN=EST_Device_1,L=password"
Have the client construct the subject and set username:enrollmentcode in subject
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-client-user-pass \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--eeuser "EST_Device_1" --eekey "L" --eepass password
Have the client use the challengePwd part of the CSR for the enrollmentcode and extract the username from the CN, supplying the username via eeuser
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-client-user-challengePwd \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--eeuser "EST_Device_1" --challengepass password
Have the client use the challengePwd part of the CSR for the enrollmentcode and extract the username from the CN, supplying the username via subject
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-client-user-challengePwd \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--subject "CN=EST_Device_1" --challengepass password
Have the client use basic authentication for the password and extract the username from the CN, supplying the username via eeuser
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-client-user-basicAuth \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--eeuser "EST_Device_1" --username EST_Device_1 --password password
Have the client use basic authentication for the password and extract the username from the CN, supplying the username via subject
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-client-user-basicAuth \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--subject "CN=EST_Device_1" --username EST_Device_1 --password password
Client Mode - Extract Username Component from CN, Vendor Certificate Auth, Birth Cert has same DN as End Entity
NOTE: The CA that issues the certificate is defined in the End Entity Profile for the user, not here.
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-vendor \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--subject "CN=EST_Device_1,OU=IoT Strategy,O=Keyfactor" --birthcert certs/birth-cert.pem --birthkey certs/birth-key.pem
./keyfactor-c-estclient \
--trust certs/trust.store --url https://ejbca-est-v8.keyfactoriot.com --alias est-ra-mode \
--clientcert certs/client.pem --clientkey certs/client.key.pem --clientpass shhh \
--cacert certs/cacert.pem --keytype RSA --keysize 2048 \
--subject "CN=EST_Device_RA_1,OU=IoT Strategy,O=Keyfactor" \
--username est_device --password est_password