Training Manual SignServer-v10-20221012 - 223306
Training Manual SignServer-v10-20221012 - 223306
SignServer
Notice of Rights
All rights reserved. No part of this book may be reproduced or transmitted in any form by any means,
electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the
publisher. For more information on getting permission for reprints and excerpts, contact
[email protected]
Notice of Liability
The information in this book is distributed on an “As Is” basis without warranty. While every precaution has
been taken in the preparation of the book, neither the authors nor PrimeKey shall have any liability to any
person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by
the instructions contained in the book or by computer software and hardware products described in it.
Trademarks
Many of the designations used by manufacturers and sellers to distinguish their products are claimed as
trademarks. Where those designations appear in this book, and PrimeKey was aware of a trademark claim,
the designations appear as requested by the owner of the trademark. All other product names and services
identified throughout this book are used in editorial fashion only and for the benefit of such companies with
no intention of infringement of the trademark. No such use, or the use of any trade name, is intended to
convey endorsement or other affiliation with this book.
Training Manual SignServer
Table of Contents
3 Roles ...............................................................................................................19
Adding User to Admin Role .........................................................................................19
Adding User to Auditor Role ........................................................................................19
Adding User to Archiver Auditor Role .........................................................................19
5 Signers............................................................................................................22
Configure and Sign using XAdES Signer ....................................................................22
Renew Signer Key and Certificate...............................................................................24
Configure and Sign using TimeStampSigner .............................................................24
Configure and Sign using MSAuthCode Signer .........................................................25
Configure and Sign using PDFSigner..........................................................................27
Configure and Sign using CMS Signer........................................................................28
Configure and Sign using Plain Signer .......................................................................29
Configure and Sign using CMS Signer with Client-Side Hashing..............................29
Training Manual SignServer
8 Validators .......................................................................................................33
9 ePassport .......................................................................................................35
Configuring MRTD SOD Signer using CryptoTokenP12A..........................................35
Sign with MRTDSODSigner..........................................................................................35
10 Integration ......................................................................................................36
Sign HelloPE.exe Server-side with MSAuthenticode Signer......................................36
Sign HelloPE.exe with CMS Signer (Client-side Hashing) .........................................37
Sign XML Server-side with XAdES Signer...................................................................37
Add TimeStamping and Sign XML Server-side with XAdES Signer ..........................37
Sign Multiple XMLs Server-side with XAdES Signer ..................................................38
Sign XML Server-side with XAdES Signer with Certificate Client Authentication ....39
11 CLI ...................................................................................................................40
Find Last SignServer Startup.......................................................................................40
Get Status of All Workers ............................................................................................40
Deactivate CryptoToken (CLI) .....................................................................................41
Activate CryptoToken (CLI) .........................................................................................41
1 Introduction PKI
Introduction to Cryptography Introduction to PKI Applications of PKI
Systems
• NPKD
• PKI Appliance
• SEE
• Cloud PKI
2 Introduction PrimeKey
PrimeKey
• Solutions and Professional Services within Applied Cryptography with focus on PKI
Introduction to Cryptography
Cryptography is the practice of secure communication between two parties in the presence of adversaries.
The history of cryptography is as old as the history of man. There has always been a need for securing
messages between two communicating parties. While in the past, the methods used have been based on
simple mathematics like letter substitution, shifting; more modern techniques make use of complex
mathematical algorithms.
The advent of computing machinery has led to a more widespread need for secure communication between
parties. Thus in a more modern sense, cryptography is the study of protocols used to overcome the influence
of adversaries. Cryptography is strongly related to the various aspects of information security such as
confidentiality, integrity, availability and non-repudiation. A system that facilitates the implementation of a
cryptographic protocol is often referred to as a cryptosystem.
Symmetric Cryptography
If within a cryptosystem, the key used for encryption and decryption is the same, the system is referred to as
a symmetric cryptosystem and the study of such as system is referred to as symmetric cryptography. There
are several symmetric cryptosystems in use today and these are the easiest to understand and implement.
The disadvantage of symmetric crypto systems is the key management of symmetric keys. In order to begin
communication, the parties need to exchange the data necessary for establishing a secure key management
process. This can be difficult if parties are dispersed over large geographic areas. Thus a person in Europe
may have difficulty exchanging information securely with a person in the Americas as it would be difficult to
create a secure channel between the two parties to exchange the require information. The solutions to key
management are often insecure and expensive and subject to attack by adversaries. Methods employed
include the use of secure post (subject to interception), the use of secure couriers (subject to compromise).
Another disadvantage of symmetric cryptography is the difficulty in using them for multi-party
communication. If the private key in one party is compromised, the entire system is compromised. It can also
be difficult to have an awareness of if the private key is compromised and by which party. Commonly used
symmetric cryptography algorithms are AES (Advanced Encryption Standard), DES (Data Encryption
Standard).
Asymmetric Cryptography
Asymmetric cryptography is a form of cryptography where keys come in pairs. One key performs the forward
function while the other key performs the reverse function. Thus the reason the cryptography is asymmetric
is because it cannot be reversed; that is the forward key cannot be used for the reverse function and vice
versa. Asymmetric cryptography is based on the mathematical concept of one-way functions or functions
that are not reversible in a mathematically. An analogy for asymmetric cryptography is a door that has two
keys; one to lock it and the other one to unlock it. Thus is it possible to create many public copies of the key
to lock the door while keeping only one key to unlock it. It is for the reason that one key can be made public
that this crypto system is also known as Public Key Cryptography and a system implementing public key
cryptography is a Public Key Crypto System (PKCS), since users typically create a matching key pair, and
make one public while keeping the other secret. A simple example of a cryptographic system that makes use
of asymmetric cryptography is for encryption. Users can send secret messages by encrypting a message
with the recipient's public key. In this case, only the intended recipient can decrypt the message, since only
that user should have access to the required secret key. The key to successful use of asymmetric encryption
is a key management system, which implements a Public Key Infrastructure. Without this, it is difficult to
establish the reliability of public keys, or even to conveniently find suitable ones.
• Is built on top of specialized hardware. The hardware is well-tested and certified in special
laboratories.
• Has a security-focused OS.
• Has limited access via a network interface that is strictly controlled by internal rules.
• Actively hides and protects cryptographic material and operations.
An HSM has special hardware that uses a physical process to create a good source of randomness (entropy)
that in turn is used to generate good quality and “perfectly” random keys.
An HSM can have very good performance. While cryptography performed on an ordinary server typically
achieves a performance of a few hundred signatures per second, some HSMs can do thousands of
signatures per second. It performs a small number of tasks, but does so very efficiently because it’s
designed and optimized for such tasks.
• Certification Authorities
• Registration Authority
• Validation Authority
• Dissemination Services
• PKI Aware Applications
• Relying Parties
• Subscribers
• Trust Centre
Certification Authorities
A Certification Authority (CA) issues and verifies certificates. The CA is responsible for maintaining the
security of the service through the provisioning of technical and procedural controls in order to ensure that
certificates are only issued to appropriate entities. As illustrated in the figure, the CA collects certificate
requests from the registration authority and returns a certificate back to the subscriber.
Registration Authority
The part of the infrastructure that collects and verified requests for certificates is called the Registration
Authority (RA). The RA implements the procedural and vetting requirements for ensuring that the certificates
are only issued to claimants. The RA implements procedures for establishing the identity of the applicant.
Validation Authority
The validation Authority provides revocation services. As a piece of digital data, a certificate cannot be
retrieved from the entity to which it is issued. Revocation involves placing the certificate on a blacklist so that
the issued certificate can no longer be used for the purpose for which it was issued. The blacklist is
commonly referred to as a Certificate Revocation List (CRL). Another commonly used procedure for
revocation checking is to publish a protocol where by external entities may query whether a certificate is
revoked. This protocol is called the Online Certificate Status Protocol (OCSP). A server that facilitates OCSP
checking is Ver:2.2 commonly referred to as an OCSP server. Within the context of a PKI system described in
this section, CRL publishing and online OCSP services are provided by the Validation authority. Thus as
illustrated below, the relying party may query the validation service on the authenticity of a certificate and
reply back on the result as illustrated in the figure.
Dissemination Services
Certificates, once issued, need to be disseminated to the outside. This can be achieved by publishing them to
external repositories: LDAP, Active Directory and others.
Relying Parties
A relying party is the party that relies on the information provided by the trust service provider. As there is no
direct relation between the trust service provider and the relying party, the party has to base its trust on
various aspects of the trust service provider. These would include reputation, presence of any relying party
agreements, policies and practice statements and so on.
Subscribers
The subscriber is the legal entity to which a certificate is issued by the certification authority. Relations
between the subscribers and certification authorities are governed by subscriber agreements. A subscriber
may be a person, a device or any other tangible device capable of owning a certificate and being identified by
it. Other terms used to describe a subscriber are end entity, user (for certificates issued to persons) and
subject.
Trust Centre
At the heart of the PKI system is the requirement to provide a centralized trusted service where relations
between previously unknown entities may be established through a trusted party. Thus as there is no natural
relationship of trust between the subscriber and the relying party although the subscriber trusts the CA and
the relying party also trusts the CA an indirect trust relationship is established between the subscriber and
the relying party. The question arises as to why the relying party should trust the CA. This is because of its'
containment within a trust center. A trust center implements processes, procedures and other security
technology that make it extremely difficult to request a certificate without validating the identity of the
subscriber.
Applications of PKI
As a security service, PKI has several applications. Some of the most popular applications are described in
the subsequent sections:
• Digital Signatures
• Network / Virtual Private Network Authentication
• Encryption
• Travel Documents
• Authentication
Note that this is not an exhaustive list and only the most commonly deployed applications are cited.
Digital Signatures
A digital signature is a piece of data which is attached to a message and which can be used to find out if the
message was tampered with during the conversation (such as through the intervention of a malicious user).
This is effective in high speed communications like TLS and in protecting documents and other information
ensuring the information has not been tampered with since it was signed. The digital signature for a
message is generated in two steps
The resulting encrypted message digest is the digital signature. The digital signature is attached to the
message and sent to the receiver. The receiver then does the following: Decrypts the digital signature to
obtain the message digest generated by the sender using the sender's public key. It uses the same message
digest algorithm used by the sender to generate a message digest of the received message.
It compares both message digests (the one sent by the sender as a digital signature, and the one generated
by the receiver). If they are not exactly the same, a third party has tampered with the message. We can be
sure that the digital signature was sent by the sender (and not by a malicious user) because only the sender's
public key can decrypt the digital signature which was encrypted by the sender's private key. It is useful to
keep in mind that what one key encrypts, the other one decrypts, and vice versa. If decrypting using the
public key renders a faulty message digest, this means that either the message or the message digest is not
exactly what the sender sent.
Using public key cryptography in this manner ensures integrity because we have a way of knowing if the
message we received is exactly what the sender sent. However, notice how the above example guarantees
only integrity. The message itself is sent unencrypted. This is not necessarily a bad thing; in some cases we
might not be interested in keeping the data private, we simply want to make sure it is not tampered with. To
add privacy to this conversation, we would simply need to encrypt the message as a second step or use an
encrypted method of transporting the information from originator to recipient such as secure email.
This technology can be applied to signing things like email, PDF documents, Microsoft Office documents,
Open Office documents to name a few. It can even be used to create signatures on files that don't support
signing internally to ensure they aren't tampered with after storage or archiving. This is especially handy for
legal evidence and documents required by regulation authorities.
Encryption
Upon generation of private/public key pairs users can utilize these keys to encrypt data of various types,
including entire storage devices like hard drives, email messages, documents, network transmissions and
many others.
Travel Documents
PKI is used as a security feature in the issuance of travel documents. Digital data is signed by a document
signer during the document issuance process. The use of PKI is part of the International Civil Aviation
Organization (ICAO) standard on travel documents and had led to a new wave of PKI implementations all
over the globe. Second and third generation travel documents make use of extended access control (EAC).
This requires an additional PKI system called the EAC PKI for issuance and verification.
Authentication
As a form of digital identification, PKI can be used to provision digital identities. This is often performed
through the use and deployment of smart cards for private key storage. The use of certificates on smart
cards for authentication is inherently supported by Microsoft systems
PKI by PrimeKey
PrimeKey provides several products capable of delivering the requirements required by a PKI management
system. Each of these products serves an individual role in the creation and maintenance of a PKI service
within the context of a trust service provider. A short description of the products is presented below:
• EJBCA
• Validation Authority
• SignServer
• SPOC
• NPKD
• RA Server
• PKI Appliance
The rest of this manual goes into more detail about the installation, configuration and administration of
some of these products.
EJBCA
EJBCA is a Java based Certificate Authority that can be used to issue and manage certificates. The EJBCA is
compliant with EAC 1.11 specification and supports EU qualified certificate directive. The EJBCA can store
its keys in a Hardware Security Module (HSM) through PKCS#11 interface. EJBCA supports various
algorithms as RSA or ECC as well as different key length. EJBCA uses X509 certificates to authenticate the
users accessing the administration GUI. EJBCA use role-based access control as well having support for
security functions like dual authorization for administrative tasks and separation of duties. EJBCA supports
both CRL and OCSP for revocation information. EJBCA version 5 is common criteria certified up to EAL 4+.
Validation Authority
The validation authority (VA) module of EJBCA provides services used to validate a certificate. These
services can run on an installed EJBCA or on a standalone VA installation Each service can be enabled/
disabled independently at compile time. The services are disabled by default. VA can be deployed for signed
OCSP responses with the signature generated in an HSM. This proposal however does not include an HSM
for the VA. The VA is built as an instance of EJBCA.
SignServer
SignServer is a Java based server-side signature service, used for signing various kinds of objects.
SignServer can store its keys in a Hardware Security Module (HSM) to enhance both security as well as
performance. SignServer communicates with the HSM through PKCS#11 interface. SignServer is a dynamic
product and able to fit several business cases. By customizing the different workers, SignServer can be
deployed in one of the following roles:
• SignServer as a TSA
SignServer is a cutting-edge signer able to provide code signing, advanced CMS and XML signatures through
the deployment and configuration of various workers. SignServer is a modular product and allows for the
creation of workers for each signing purpose. It is possible to create several parallel signers that use
different certificates to perform signing operations. Within the context of SignServer, each signer is referred
to as a worker. A single deployment can host several workers. SignServer provides an SDK, WS Interface and
a command level interface (CLI) for communication with the server. External integration can be performed
using any one of these interfaces. A worker holds the policy for signing operations. Each worker has a
number of user keys associated with it. SignServer integrated with a database and HSM for persistent
storage. The DB stores configuration, end user certificates (in encrypted format) and log information while
the HSM stores certain private keys for specified operations.
SPOC
SPOC (Single Point of Contact) is a scheme developed by European Union (EU) to enable Extended Access
Control (EAC) to Machine-Readable Travel Documents (MRTD) like pass- ports. The purpose of EAC is
allowing each country to decide which other countries who should be permitted to read biometric
information. A single SPOC server per country is serving the cross-certification requests that are needed for
issuing Inspection System (IS) certificates matching the national MRTDs EAC requirements. PrimeKey
Solution's SPOC Server is tightly integrated with PrimeKey's EJBCA. The latter can simultaneously serve as a
CVCA (Country Verifying Certification Authority) and a set of DVCAs (Document Verifier Certification
Authorities). SPOC Server supports the Web Service interface according to CSN-36 9791.
NPKD
The LDAP server forms the storage database for the storage and maintenance of the certificates. The LDAP
shall store certificates using the same schema as the ICAO PKD. The LDAP server shall be synchronized with
the ICAO PKD server and also have provisions to manually import certificates whenever required. Manual
Import of the following is supported via command line tools. Web based GUI applications for import are can
be supported:
• CSCA
• DSC
• Defect lists
• CSCA Masterlist
• Certificate Import
• CRL Import
• CRL Activation
• Certificate De-activation
• CRL export
• Retrieving Information from an IS
RA Server
The RA Server facilitates centralized registration facilities for Inspection Systems (IS). The RA Server is
designed to facilitate the following functions:
In the absence of a RA Server, the IS would be required to handle certificate requests several DVCAs
depending on the range of documents and countries that it would like to inspect. This can introduce errors
into the procedures especially if several IS systems are sending requests at the same time. In addition, the
short validity of the IS certificates can lead to additional issues with the system.
PKI Appliance
The PrimeKey PKI Appliance uses EJBCA 7 Enterprise Edition, with ability to deploy all PKI components,
including Certificate Authority, Registration Authority and Validation Authority (CA/RA/VA). In a single
deployment of EJBCA, it is possible to effectively manage multiple CAs, thus reducing need for multiple,
dedicated hardware units. Similarly, one VA can operate as OCSP responder on behalf of multiple issuing
CAs. When starting up, the setup wizard provides with faster and easier deployment. Out of the box
functionality for backup/restore and software updates, as well as key management functions, are designed
to simplify operations- and maintenance tasks. Integrated with FIPS 140-2 Level 3 certified HSM, the
PrimeKey PKI appliance has robust hardware:
The standard configuration can issue up to 100k certificates per hour per device, supports full life cycle for
8M+ certificates per device, and the Validation Authority can serve up to 1000 OCSP responses per second.
While a single unit delivers plenty of power on its own, the PrimeKey PKI Appliance is engineered to make it
easy to scale both vertically and horizontally. In that sense, PrimeKey provides a robust building block ́ for
complex and large-scale PKI projects.
Policy Documents
Naming document
Defines the certificate and end entity profiles used in the PKI.
3 Roles
This section covers how to add a user to the following roles:
4 Crypto Workers
This section covers the following:
5 Signers
This section covers the following:
Note that this signer now uses the key and certificate signer00001 from the PKCS#12 file used by
CryptoTokenP12.
<document>Test 1</document>
This name is by default not required by EJBCA, but it is still recommended to specify
this identification of the CSR.
10. Click Generate and then click Download and save the request as xades00001.csr
11. Bring the request xades00001.csr to the CA to obtain the certificate issued for it. From the CA, you
should get the signer certificate file, as well as the CA certificate(s). They are either in two separate
PEM files, or in one PEM file including all certificates (full chain)
12. To add the new certificates for the signer, select the worker XadESSignerP11 and click Install
certificates
13. Click Browse and select your signer certificate file
14. Click Add, and then Install
15. Select the Status Summary tab and verify that the status now is ACTIVE
<document>Test 2</document>
• Click Generate and then Download and save the request as timestamp00001.csr
• Bring the request timestamp00001.csr to the CA to obtain the certificate issued for it. From the CA,
you should get the signer certificate file as well as the CA certificates. They are either in two separate
PEM files, or in one PEM file including all certificates
• To configure the new certificates for the signer, select the worker TimeStampSignerP11 and click
Install certificates
• Click Browse and select your signer certificate file
• Click Add and then Install
• Select the Status Summary tab and verify that the status is ACTIVE
3. You should now get time stamp reply and time stamp request validated with status (Operation Okay)
Note that this signer now uses the key and certificate signer00001 from the PKCS#12 file
used by CryptoTokenP12.
Note that this signer now uses the key and certificate signer00001 from the PKCS#12 file
used by CryptoTokenP12.
Note that this signer now uses the key and certificate signer00001 from the PKCS#12 file
used by CryptoTokenP12.
11. You should now get time stamp reply and time stamp request validated with status (Operation Okay)
cp /opt/wildfly/standalone/deployments/mariadb-java-client.jar /opt/signserver/
lib/ext/jdbc/jdbc.jar
1. Run the command to query the last 20 entries in the audit log (as wildfly user):
8 Validators
To validate the signature and the certificate chain using the XAdES validator, do the following:
# General properties
WORKERGENID1.TYPE=PROCESSABLE
WORKERGENID1.IMPLEMENTATION_CLASS=org.signserver.module.xades.validator.XAdESVa
lidator
WORKERGENID1.NAME=XAdESValidator
WORKERGENID1.AUTHTYPE=NOAUTH
4. Click Apply
5. Select the worker XadESSignerP11
6. Copy the issuer certificate with the intermediate and root CAs if any including:
----BEGIN CERTIFICATE---
and
---END CERTIFICATE---
7. Past the certificate into a text editor, and remove the white spaces at the beginning of each line.
8. Copy the text again.
9. Select the worker XAdESValidator, and click Configuration
10. Click Edit on the TRUSTANCHORS
11. Paste the self-signed CA certificate (the certificate with matching Subject and Issuer lines).
12. Click Submit.
13. Click Edit on the CERTIFICATES and paste the intermediateCA and issuingCA if Any.
14. Click Submit.
15. Go to the SignServer Client Web on: https://signserver.primekey.training:8442/signserver/clientweb
16. Click File Upload tab
9 ePassport
The following describes the steps required to configure and sign using the MRTD SOD Signer:
Note that this signer now uses the key and certificate signer00003 from the PKCS#12 file used by
CryptoTokenP12A.
10 Integration
This section covers:
In order to use the SignClient utility, you need to have JAVA 11 JRE or JDK installed
cd signserver/bin/
6. Create a directory:
mkdir ../training_files_signserver/out
ls -al ../training_files_signserver/out
9. Copy the file to a MS Windows VM, right-click the file, select Properties and examine the signature
data
ls -al ../training_files_signserver/out
3. Copy the file to a MS Windows VM, right-click the file, select Properties and examine the signature
data.
ls -al ../training_files_signserver/out
3. Open the file to verify that the file has been signed
ls -al ../training_files_signserver/out
9. Open the HelloPE_MSAuthSigned_TimeStamped.exe file to verify that the file has been signed
ls -al ../training_files_signserver/batch/out/
ls -al ../training_files_signserver/out
11 CLI
The following sections describe CLI commands to use in order to:
1. Open the server log using the "less" tool (run as wildfly user):
less /opt/wildfly/standalone/log/server.log
?SIGNSERVER_STARTUP
date -d @$((1496062751485/1000))
cd /opt/signserver
cd /opt/signserver
cd /opt/signserver
12 Peer Connectors
Introduction
A peer connector is used to securely communicate with an EJBCA instance. For SignServer it's used for
certificate renewals through the secure tunnel.
Both the EJBCA and the SignServer are used during this exercise so for simplicity use two web
browser windows, one for EJBCA and one for SignServer.
SignServer:
SignServer:
EJBCA:
The PEERS_VISIBLE property should now be set to true which means that the worker
will use the peer connector and be visible in EJBCA.
SignServer:
Renew the key pair and certificate for the Time Stamp Signer worker
EJBCA:
Dispatchers
This section covers how to configure a dispatcher worker that can distribute signing requests between
multiple signers.
Setting Up a FirstActiveDispatcher
To configure a PKCS#12 crypto worker from the SignServer Admin Web, do the following:
4. Select firstactivedispatcher.properties from the Load From Template list menu and click Next
6. Click Apply and verify that the new worker appears in the worker list
<document>Dispatcher Test</document>
Authorizers
This section covers how to configure the following types of authorization for workers:
6. Click Add to add a new configuration property and set the property as following:
7. Click Submit
8. Perform a signing using the FirstActiveDispatcher worker in the Client Web. You should be prompted
to provide a username and password
12. In the Input Data field enter XML data such as:
<document>Authorization Test</document>
13. Click Submit. You should get an authorization error because the request was sent over HTTP
16. In the Input Data field enter XML data such as:
<document>Authorization Test</document>
17. Click Submit. You should now get a signed response because the request was sent over TLS
authenticated with the adminisitrator certificate