Certificates
What is a certificate?
A certificate is a digital ID. It states who it belongs to (e.g. name and e-mail address) and how long it is valid, and it carries the signature of the authority that issued it. This authority is called a certification authority (CA). Its own certificate is the root certificate.
Every certificate comes with a private key that only its owner has. When logging in, the owner uses it to prove that the ID really belongs to them. The server checks two things: is the certificate signed by a root certificate I trust? And does the other side have the matching private key? If both are true, the user is logged in.
Why certificates instead of passwords?
| Password | Certificate | |
|---|---|---|
| How is it checked? | The server compares the password entered | The server checks the signature and the private key |
| Can it be guessed or spied on? | Yes | No |
| Do you have to remember it? | Yes | No, it is stored on the card or device |
| What happens when the password changes? | Remember the new password and enter it everywhere | Nothing |
| When does it become invalid? | At the next mandatory change | On the expiry date you set yourself |
TheFlex offers two places for the personal certificate: on a smartcard or installed on the device.
What you create here
| File | What it is | Where it goes |
|---|---|---|
| ca.key | Private key of the root certificate | Keep it safe, never pass it on. Whoever has it can issue IDs for your company. |
| ca.crt | Root certificate | Upload to SAP or Entra ID |
| johndoe.crt | Personal certificate, public part | If needed, as a sample in SAP (CERTRULE) |
| johndoe.p12 | Personal certificate with private key, protected by a password | Onto the smartcard with FlexKey |
Instead of OpenSSL, an existing certification authority in your company can also issue the certificates. All that matters is that the result meets the requirements below and your system trusts the root certificate.
Requirements for the personal certificates
Whether you create the certificates yourself or obtain them from an existing certification authority, they must:
- be signed by the root certificate you store in SAP or Entra ID,
- allow login as their purpose (
extendedKeyUsage = clientAuth), otherwise some systems reject them, - contain the information your system uses to find the user, in our example the e-mail address,
- be available as .p12 files with private key, all with the same password. FlexKey and TheFlex work with a single certificate password for all cards.
The following steps show an example with OpenSSL. For many users, it is worth putting them into a script.
1. Create the root certificate
This is done only once:
openssl genrsa -out ca.key 4096
openssl req -new -x509 -days 18260 -key ca.key -out ca.crtOpenSSL asks for country, company and name. This information later appears as the issuer in every certificate. -days 18260 makes the root certificate valid for 50 years.
The result is ca.crt. Upload it to your system: Certificates with SAP or Certificates with Microsoft Entra ID.
Protect ca.key
Whoever owns ca.key can issue certificates that your system accepts. Keep the file offline or in a password safe, not on a shared drive.
2. Create a personal certificate
For each user, create two small text files. In the example, the user is called johndoe.
johndoe.conf describes who the certificate belongs to:
[req]
distinguished_name = req_distinguished_name
x509_extensions = v3_req
prompt = no
[req_distinguished_name]
C = DE
ST = Bayern
L = Wuerzburg
O = Flexus AG
OU = IT
CN = johndoe@mycompany.net
[v3_req]
keyUsage = nonRepudiation, digitalSignature, keyEncipherment
extendedKeyUsage = clientAuth
subjectAltName = email:johndoe@mycompany.netjohndoe.ext defines the purpose:
keyUsage = digitalSignature, nonRepudiation
extendedKeyUsage = clientAuth
subjectAltName = email:johndoe@mycompany.netAdjust company and e-mail address. The e-mail address must match the one stored for the user in the system.
Then create the certificate (adjust the paths to ca.crt and ca.key if needed):
openssl genrsa -out johndoe.key 4096
openssl req -new -key johndoe.key -out johndoe.csr -config johndoe.conf
openssl x509 -req -days 730 -sha512 -in johndoe.csr -CA ../ca.crt -CAkey ../ca.key -out johndoe.crt -extfile johndoe.ext -CAcreateserial
openssl pkcs12 -export -out johndoe.p12 -inkey johndoe.key -in johndoe.crt -chain -CAfile ../ca.crt -passout pass:mysupersecretpassword-days 730 makes the certificate valid for two years. After that, the user needs a new one and their card is rewritten.
The result:
- johndoe.crt contains only the public part. If needed, upload it to the system, in SAP e.g. as the sample certificate in CERTRULE.
- johndoe.p12 additionally contains the private key, protected by the password. This file goes onto the smartcard with FlexKey. It never belongs in the system or in the wrong hands.
- johndoe.key and johndoe.csr are no longer needed afterwards and can be deleted.
One password for all
Use the same password for all users with -passout and keep it safe. It is entered in FlexKey as Cert PW. Make sure to replace the example password with your own.
3. Check the certificate
Install ca.crt on the PC: double-click it, choose Install Certificate... and select Trusted Root Certification Authorities as the store. Then open johndoe.crt with a double-click. Under Certification Path, the root certificate must appear above the personal certificate, without a warning. If it is missing, the root certificate was not installed or was installed incorrectly, or the certificate was signed with a different root certificate.
The quickest way to test the login afterwards is in the browser on the PC, see Certificates with SAP.