Lesson Contents
When you use pre-shared keys, you have to manually configure a pre-shared key for each peer that you want to use IPsec with.
With digital certificates, each peer gets a certificate from a CA (Certificate Authority). When two peers want to use IPsec, they exchange their certificates to authenticate each other.
What’s the big difference? One advantage of digital certificates is scalability.
For example, let’s say you have one firewall at your main office and 10 branch offices with a firewall each. All branch offices use IPsec to encrypt traffic between the branch and main office. For security reasons, we use a different pre-shared key between the main office and each branch office.
When you want to add an additional ASA firewall at your main office (perhaps for redundancy) then you will have to configure 10 additional pre-shared keys, one for each branch office. When two branch offices want to use IPsec between each other, you’ll need another pre-shared key.
With digital certificates, all firewalls will trust the certificates that are signed by the CA. When you want to use IPsec with a new firewall, the only thing you need to do is add a certificate to the new firewall. The other firewalls will automatically trust it since it was signed by the CA.
In this lesson, I’ll explain how to configure your Cisco ASA firewalls to use digital certificates for IPsec. We will use an OpenSSL server as the CA that signs the certificates for our firewalls.
Before you continue with this lesson, I would recommend finishing the following two lessons first:
In the first lesson you will learn how to build a CA with OpenSSL, the second lesson explains how to configure IPsec site-to-site VPNs with pre-shared keys.
Having said that, let’s get to work!
Configuration
We will use the following topology:
ASA1 and ASA2 are our two firewalls that we will configure to use IPsec to encrypt traffic between 192.168.1.0/24 and 192.168.2.0/24. Our routers, R1 and R2 are only used to test the VPN. I’m using two Cisco ASAv firewalls running ASA 9.24(1) and two IOSv routers. The CA is an Ubuntu 24.04 server with OpenSSL 3.0.13.
In the middle you will find the OpenSSL server. We don’t need network connectivity for this server to sign our certificates.
One thing you should check first is if your time, date and timezone are correct on all devices:
ASA1# show clock
16:17:59.308 CET Thu Nov 19 2026
ASA2# show clock
16:18:07.682 CET Thu Nov 19 2026
It’s a good idea to configure NTP on your Cisco ASA firewalls.
Install Root Certificate
Our firewalls have to trust our CA and we can do this by importing its root certificate. Let’s configure a trustpoint:
ASA1(config)# crypto ca trustpoint MY_CA
ASA1(config-ca-trustpoint)# enrollment terminal
The trustpoint is called MY_CA and we will enroll the certificate from the terminal. We can do this with the following command:
ASA1(config)# crypto ca authenticate MY_CA
Enter the base 64 encoded CA certificate.
End with the word "quit" on a line by itself
-----BEGIN CERTIFICATE-----
MIIGCjCCA/KgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBnTELMAkGA1UEBhMCTkwx
FjAUBgNVBAgMDU5vcnRoLUJyYWJhbnQxEDAOBgNVBAcMB1RpbGJ1cmcxFzAVBgNV
BAoMDk5ldHdvcmtsZXNzb25zMSAwHgYDVQQDDBdDQS5uZXR3b3JrbGVzc29ucy5s
b2NhbDEpMCcGCSqGSIb3DQEJARYaYWRtaW5AbmV0d29ya2xlc3NvbnMubG9jYWww
HhcNMjYxMTE5MTQ1OTQwWhcNMzYxMTE2MTQ1OTQwWjCBnTELMAkGA1UEBhMCTkwx
FjAUBgNVBAgMDU5vcnRoLUJyYWJhbnQxEDAOBgNVBAcMB1RpbGJ1cmcxFzAVBgNV
BAoMDk5ldHdvcmtsZXNzb25zMSAwHgYDVQQDDBdDQS5uZXR3b3JrbGVzc29ucy5s
b2NhbDEpMCcGCSqGSIb3DQEJARYaYWRtaW5AbmV0d29ya2xlc3NvbnMubG9jYWww
ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCr2kM0JoTFgnh+txsGz2sN
dSY3T4aLQ6X4IQVb9cOUkgUnm1lxWCRLvAL8BmK+AsqIMsehmXwX7vO4fumvPDnD
/NT1v6EMGFrnoeTXfeNFz9mQb6HhRoEJzHI4MLbk+F+S1zPmS+C6qSJSaOfS4VGj
FETQbwN7US/yZgduksGUfhdlEBQkubt/xGXd6vT1SKyt/9b6RM73PBh0xW1132G3
AYDyZgO1XXJHcsKOHjcIsEcw436HP55S4D6pjVsHcE7Yt0bN3lTvA7AZozWl3lQ+
dh/m9BPzOhewumc8qzHhADd9zy7Ma+iy0KH+Va+AGGIOSsdFoDxmX0WRG6QZmH6K
G7qzhV9eCVy+hJkOr0d74jg6eaLPgXf7g9Y1lowL3pvndRpKKKmqLWCGgo4PWBD9
mOwEDKgSplP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lKTj7srLXACnM
NYfCdrz0l83JQHC1ZZc=
-----END CERTIFICATE-----
quit
Above I have pasted the contents of the cacert.pem file of my OpenSSL server. Don’t forget to add quit at the bottom. Once you have done this, you will see the following message:
INFO: Certificate has the following attributes:
Fingerprint: 8d021577 58cc8d18 5e3068ac 0390e176
Do you accept this certificate? [yes/no]: yes
WARNING: CA certificates can be used to validate VPN connections,
by default. Please adjust the validation-usage of this
trustpoint to limit the validation scope, if necessary.
Trustpoint CA certificate accepted.
% Certificate successfully imported
ASA1 now trusts certificates that are signed by our CA.
Generate CSR (Certificate Signing Request) on ASA
The next step is to create a certificate for ASA1. We will do this by creating a CSR (Certificate Signing Request) which the CA will sign.
Let’s configure a hostname and domainname for our ASA:
ASA1(config)# hostname ASA1
ASA1(config)# domain-name networklessons.local
The CSR has to be signed with a private key so let’s generate one:
ASA1(config)# crypto key generate rsa label ASA1_KEY modulus 2048
Keypair generation process begin. Please wait...
The RSA keypairs were successfully generated.
This will generate a key-pair called ASA1_KEY. Now we will configure the attributes for our CSR in the trustpoint:
ASA1(config)# crypto ca trustpoint MY_CA
Let’s configure the FQDN (Fully Qualified Domain Name) for our ASA:
ASA1(config-ca-trustpoint)# fqdn ASA1.networklessons.local
And the attributes that identify our device:
ASA1(config-ca-trustpoint)# subject-name O=Networklessons, C=NL, EA=admin@networklessons.local, ST=North-Brabant, CN=ASA1.networklessons.local
We also need to specify the key that we want to use to sign the CSR. We will use the key-pair that we just created:
ASA1(config-ca-trustpoint)# keypair ASA1_KEY
We are now ready to create the CSR:
ASA1(config)# crypto ca enroll MY_CA
% Start certificate enrollment ..
% The subject name in the certificate will be: O=Networklessons, C=NL, EA=admin@networklessons.local, ST=North-Brabant, CN=ASA1.networklessons.local
% The fully-qualified domain name in the certificate will be: ASA1.networklessons.local
% Include the device serial number in the subject name? [yes/no]: no
Display Certificate Request to terminal? [yes/no]: yes
Certificate Request follows:
-----BEGIN CERTIFICATE REQUEST-----
MIIDQTCCAikCAQAwgbcxFzAV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xt16SI/c1ZVl
LYqE4NlmCRRTg2Ybq26vlwKgyF7l
-----END CERTIFICATE REQUEST-----
Redisplay enrollment request? [yes/no]: no
Above you can see that the firewall asks us to include the serial numbers, this is not required. Answer yes to display the CSR in the terminal.
We require this CSR on our CA so copy the contents (including the BEGIN and END lines) into a new file on your CA. I will call my file ASA1_CSR.txt.
We can use OpenSSL to sign the CSR:
# openssl ca -in ASA1_CSR.txt -out ASA1_SIGNED.pem
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for /root/ca/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 4661 (0x1235)
Validity
Not Before: Nov 19 15:18:04 2026 GMT
Not After : Nov 19 15:18:04 2027 GMT
Subject:
countryName = NL
stateOrProvinceName = North-Brabant
organizationName = Networklessons
commonName = ASA1.networklessons.local
emailAddress = admin@networklessons.local
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Subject Key Identifier:
6A:4B:B3:F5:C9:5A:2A:69:52:D1:CD:A6:53:E6:17:34:37:56:8A:08
X509v3 Authority Key Identifier:
79:F6:CA:D6:E4:94:14:60:65:36:B5:02:E1:D0:6D:38:1D:3C:C5:9E
Certificate is to be certified until Nov 19 15:18:04 2027 GMT (365 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Database updated
Answer yes to both questions and OpenSSL will sign the certificate for us, it will be stored in the ASA1_SIGNED.pem file.
Here’s what the file looks like. It starts with the certificate in text format, followed by the Base64-encoded certificate:
Certificate:
Data:
Version: 3 (0x2)
[output omitted]
-----BEGIN CERTIFICATE-----
MIIE9TCCAt2gAwIBAgICEjUwDQYJKoZIhvcNAQELBQAwgZ0xCzAJBgNVBAYTAk5M
MRYwFAYDVQQIDA1Ob3J0aC1CcmFiYW50MRAwDgYDVQQHDAdUaWxidXJnMRcwFQYD
VQQKDA5OZXR3b3JrbGVzc29uczEgMB4GA1UEAwwXQ0EubmV0d29ya2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j2UTcqgIOkNym39mrIcVHr/c0hBAwSy8x
+DkWPDq1l9ed9NgZos9MpS6mEI+SF5ZdKLvsE6Wq9x9490qDYALB/MEWkIYm0yqk
1pciCn1y1WB60J1IQlV3+bIcJZaqdkaU83Z5bED/7KcslQAtLSTMeyj8IARk41IF
vQahQVQm/FgzLFX0I9D8xDaF9adY8Q9D0tKpqWO8GgWKBoniQr3fmjagdkkWZdMK
DEt+GbO13iscBiFq+3+/qFJwaTGPnlG1ZZQMIOH3KH/bm2WnCcT9YTqUPyXDdTxW
nX2QGstl4G6ebe3oqJyHr4H3M8E+fMqybpPD7oM4RN16xjG/j+qmdyU20yG4NKkg
fDTJ4npcfuZoDe+bep8bjjY7VgUIg60lyAQx/gPahOWLtpiF8NMQdAQHIYndj89a
uYmP9v8M5A0TjfGTNmQYq/UNutfNkgYQsg==
-----END CERTIFICATE-----
Now we need to import this certificate to ASA1. Use the crypto ca import command for this:
ASA1(config)# crypto ca import MY_CA certificate
% The fully-qualified domain name in the certificate will be: ASA1.networklessons.local
Enter the base 64 encoded certificate.
End with the word "quit" on a line by itself
-----BEGIN CERTIFICATE-----
MIIE9TCCAt2gAwIBAgICEjUwDQYJKoZIhvcNAQELBQAwgZ0xCzAJBgNVBAYTAk5M
MRYwFAYDVQQIDA1Ob3J0aC1CcmFiYW50MRAwDgYDVQQHDAdUaWxidXJnMRcwFQYD
VQQKDA5OZXR3b3JrbGVzc29uczEgMB4GA1UEAwwXQ0EubmV0d29ya2xlc3NvbnMu
bG9jYWwxKTAnBgkqhkiG9w0BCQEWGmFkbWluQG5ldHdvcmtsZXNzb25zLmxvY2Fs
MB4XDTI2MTExOTE1MTgwNFoXDTI3MTExOTE1MTgwNFowgY0xCzAJBgNVBAYTAk5M
MRYwFAYDVQQIDA1Ob3J0aC1CcmFiYW50MRcwFQYDVQQKDA5OZXR3b3JrbGVzc29u
czEiMCAGA1UEAwwZQVNBMS5uZXR3b3JrbGVzc29ucy5sb2NhbDEpMCcGCSqGSIb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nCcT9YTqUPyXDdTxW
nX2QGstl4G6ebe3oqJyHr4H3M8E+fMqybpPD7oM4RN16xjG/j+qmdyU20yG4NKkg
fDTJ4npcfuZoDe+bep8bjjY7VgUIg60lyAQx/gPahOWLtpiF8NMQdAQHIYndj89a
uYmP9v8M5A0TjfGTNmQYq/UNutfNkgYQsg==
-----END CERTIFICATE-----
quit
INFO: Certificate successfully imported
Paste the certificate from the ASA1_SIGNED.pem file (the BEGIN and END lines and everything in between) on the ASA and it will import the certificate. Don’t forget to add “quit” at the end of the certificate.
ASA1 now has a certificate that it can use to authenticate itself.
We can repeat this process on ASA2. Let’s import the root certificate of the CA:
ASA2(config)# crypto ca trustpoint MY_CA
ASA2(config-ca-trustpoint)# enrollment terminal
ASA2(config)# crypto ca authenticate MY_CA
Enter the base 64 encoded CA certificate.
End with the word "quit" on a line by itself
-----BEGIN CERTIFICATE-----
MIIGCjCCA/KgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBnTELMAkGA1UEBhMCTkwx
FjAUBgNVBAgMDU5vcnRoLUJyYWJhbnQxEDAOBgNVBAcMB1RpbGJ1cmcxFzAVBgNV
BAoMDk5ldHdvcmtsZXNzb25zMSAwHgYDVQQDDBdDQS5uZXR3b3JrbGVzc29ucy5s
b2NhbDEpMCcGCSqGSIb3DQEJARYaYWRtaW5AbmV0d29ya2xlc3NvbnMubG9jYWww
HhcNMjYxMTE5MTQ1OTQwWhcNMzYxMTE2MTQ1OTQwWjCBnTELMAkGA1UEBhMCTkwx
FjAUBgNVBAgMDU5vcnRoLUJyYWJhbnQxEDAOBgNVBAcMB1RpbGJ1cmcxFzAVBgNV
BAoMDk5ldHdvcmtsZXNzb25zMSAwHgYDVQQDDBdDQS5uZXR3b3JrbGVzc29ucy5s
b2NhbDEpMCcGCSqGSIb3DQEJARYaYWRtaW5AbmV0d29ya2xlc3NvbnMubG9jYWww
ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCr2kM0JoTFgnh+txsGz2s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bND+yv+77yNPI/hWHxE6sl9dxM3ODV8XFCD
4M3MpdYThylBx/Eknf1/uZ9OuPdzFYY8KabZ+54sYl6fcKz3tu4aTW1WfHa2TvyP
X/H3UVIpP9C3SRsogfSuJTmg44nfYArXE29Jl3XU2dJwG08JW68cpf5fEef6O3hs
nilCvEWNYvdKe/4UFqDdgWIqov2kbY2I+GkIVrArLkbkRWhETXMU4yQCjOsvtVjZ
jY1BLAAl2pkEXmbPUGulYnr8nCJpd0OZLKA8nh460TsFIk3ECvMyCqgqwmAG5olq
Di1fCMn9YIbEn6XLqNdAiJwMkAAMwZWIio6g0wO1766SaE2vFb+2CRdU2ScL6SBd
vg38HnS+xeTrdnILtn3mNGC6q8rgp6i13zG5OwaWxOUjIicaD74lKTj7srLXACnM
NYfCdrz0l83JQHC1ZZc=
-----END CERTIFICATE-----
quit
INFO: Certificate has the following attributes:
Fingerprint: 8d021577 58cc8d18 5e3068ac 0390e176
Do you accept this certificate? [yes/no]: yes
WARNING: CA certificates can be used to validate VPN connections,
by default. Please adjust the validation-usage of this
trustpoint to limit the validation scope, if necessary.
Trustpoint CA certificate accepted.
% Certificate successfully imported
Now we can generate a key-pair and configure the attributes for the CSR:
ASA2(config)# crypto key generate rsa label ASA2_KEY modulus 2048
Keypair generation process begin. Please wait...
The RSA keypairs were successfully generated.
ASA2(config)# crypto ca trustpoint MY_CA
ASA2(config-ca-trustpoint)# fqdn ASA2.networklessons.local
ASA2(config-ca-trustpoint)# subject-name O=Networklessons, C=NL, EA=admin@networklessons.local, ST=North-Brabant, CN=ASA2.networklessons.local
ASA2(config-ca-trustpoint)# keypair ASA2_KEY
ASA2(config-ca-trustpoint)# exit
Let’s create the CSR:
ASA2(config)# crypto ca enroll MY_CA
% Start certificate enrollment ..
% The subject name in the certificate will be: O=Networklessons, C=NL, EA=admin@networklessons.local, ST=North-Brabant, CN=ASA2.networklessons.local
% The fully-qualified domain name in the certificate will be: ASA2.networklessons.local
% Include the device serial number in the subject name? [yes/no]: no
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+mYNx0qdn9R+6HlNXR7qMNWihOPHXrE8ssZI
TmKSdXA3fRLrej8lugkWRVf97aPNS8dAonyaUQqcoCsDWIX/jwYeCTPLUyl14YGY
SeaacTv1cKAj//8WGgy6JSrKlq2c
-----END CERTIFICATE REQUEST-----
Redisplay enrollment request? [yes/no]: no
And sign the CSR with OpenSSL to create a certificate, saved as ASA2_SIGNED.pem.
# openssl ca -in ASA2_CSR.txt -out ASA2_SIGNED.pem
Using configuration from /usr/lib/ssl/openssl.cnf
Enter pass phrase for /root/ca/private/cakey.pem:
Check that the request matches the signature
Signature ok
Certificate Details:
Serial Number: 4662 (0x1236)
Validity
Not Before: Nov 19 15:18:12 2026 GMT
Not After : Nov 19 15:18:12 2027 GMT
Subject:
countryName = NL
stateOrProvinceName = North-Brabant
organizationName = Networklessons
commonName = ASA2.networklessons.local
emailAddress = admin@networklessons.local
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
X509v3 Subject Key Identifier:
4E:89:AC:EF:0D:03:96:7B:32:67:4B:2C:CD:50:74:63:3E:EA:25:6E
X509v3 Authority Key Identifier:
79:F6:CA:D6:E4:94:14:60:65:36:B5:02:E1:D0:6D:38:1D:3C:C5:9E
Certificate is to be certified until Nov 19 15:18:12 2027 GMT (365 days)
Sign the certificate? [y/n]:y
1 out of 1 certificate requests certified, commit? [y/n]y
Write out database with 1 new entries
Database updated
Now we need to import this certificate on ASA2. Open the new ASA2_SIGNED.pem file, we are going to paste it on ASA2:
ASA2(config)# crypto ca import MY_CA certificate
% The fully-qualified domain name in the certificate will be: ASA2.networklessons.local
Enter the base 64 encoded certificate.
End with the word "quit" on a line by itself
-----BEGIN CERTIFICATE-----
MIIE9TCCAt2gAwIBAgICEjYwDQYJKoZIhvcNAQELBQAwgZ0xCzAJBgNVBAYTAk5M
MRYwFAYDVQQIDA1Ob3J0aC1CcmFiYW50MRAwDgYDVQQHDAdUaWxidXJnMRcwFQYD
VQQKDA5OZXR3b3JrbGVzc29uczEgMB4GA1UE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WpnF8
A7DotPMDrZIndfH+q7PBWQl5ZauRjWcCh/YjhEOhNo90hpHyrU8FVw3a2inDXTEU
VsUPhyN26B+qtkgRKaQ70EPsUVwZ2E0+7qvLgv8uSsgScA6O9HorvOYaDnDbB5ZE
LNe8OAcdLhESlwow+NUaVMrHpxcVYIh24pYbv9R5bA/U8n2KZ1fh3JqMceCn4/uO
iaMRKySBYdOEVr4gTKC8/Ff1kqONKK2D33eNbpi32kQZwrRY9kJ78lD/xF5VQAXo
TULfuXO5hzGNt2uMOVDgVS5M7LdsOQD92sAm74Z51Q9twxgbeSWW+PS9vs8G4oZX
lfg5JhDeAzSVE5iM4P15lx2sr0rjpw1yD1Qax307WHgaHiXq4G+imQTJYZs6IsPC
q1aXZuZNOa7VnbvyiVpgs477T7eenL0+J4iXk2tALzWBPWr2DK/XwIaQ1ulOAgcM
9sl8J7/sdkjZhGTJGYiAIyOvXdxzuvcOpA==
-----END CERTIFICATE-----
quit
INFO: Certificate successfully imported
That’s it. ASA2 now has a certificate.
Both ASA firewalls trust our CA and each has a certificate that it can use for authentication. Time to configure IPsec.
Phase 1 Configuration
The VPN configuration for digital certificates is 99% the same as for pre-shared keys. First we will configure phase 1:
Rene,
Well done with this post, please post more article with this kind.
Thank you
Rene,
Thanks for the presentation, great info as always…
What would be the advantages of changing my current ASA VPN Pre-Shared Keys to Certificates?
I am kind of new to certificates, so what would be the process for my customers who connect with PSK VPNs? Would they need to provide me certificate from a trusted CA for my ASA, and I would provide them a certificate as well?
If i have a couple hundred VPNs, can i provide the same certificate to every customer, or is that not a best practice?
Thanks again for all the great tutorials.
Hi Brian,
Security-wise, the public/private key of a certificate are typically longer than a pre-shared key.
If you want to use certificates then both devices will have to trust the same root CA. You could use your own CA like I did with this example and sign two certificates. One for your firewall and one for the customer. Since both devices trust the CA, they will trust each other’s certificate.
This is the main advantage of using certificates. For example, let’s say you have 100 customers that build a VPN to your main office’s firewall. If you want to
... Continue reading in our forumHI my friend.
I am not sure if CA must be always available to the peers even when they authenticate each other. At the moment CA is not available the vpn will failed? what happen if reload one of the peers? it was only available at the moment of enrolling and authenticating certificates, could you explain me please?
Can you provide more details on the significance of the hostname on the device and in the CSR/cert? Does the cert hostname need to always match the ASA assigned hostname? Do either of those hostnames need to match a forward or reverse DNS name registered for the device?