Updated on 2026-10-10 GMT+08:00

Uploading a Certificate to WAF

In cloud CNAME and dedicated access, WAF functions as a reverse proxy for protected websites. All HTTPS access traffic from clients goes to WAF before being forwarded to the origin server. If a protected website uses HTTPS as the client protocol, an SSL certificate is required to encrypt the communication between the client and WAF. The SSL certificate is the only valid credential and encryption carrier for HTTPS communication. If no SSL certificate is configured for the website, the browser will block requests to it, display a message indicating that the website is insecure, and show a connection failure.

Therefore, if you set Client Protocol to HTTPS when adding your website to WAF, you need to upload the certificate to WAF and use it for the protected website to ensure that the communication between the client and WAF is encrypted.

Concepts

  • International certificates: WAF supports international certificates. International certificates comply with international cryptographic standards and use the RSA or ECC algorithm. They are supported by most browsers and clients and are commonly used for Internet services. Only one certificate file and one private key are required.
  • SSL Certificate Manager (SCM): An SSL certificate management platform on Cloud Certificate & Manager (CCM) of Huawei Cloud. Huawei Cloud works with globally renowned Certificate Authorities (CAs) to provide you with a one-stop platform that enables full-lifecycle management of SSL certificates. This service ensures trusted authentication and secure data transmission for websites. You can purchase, upload, and renew certificates, and push them to WAF with just a few clicks.
  • PEM format: ASCII text certificate. The file starts with ‑‑‑‑BEGIN XXX‑‑‑‑ and ends with ‑‑‑‑END XXX‑‑‑‑. WAF supports only PEM certificates. If the certificate is in binary format, such as CER, CRT, PFX, P7B, or DER, convert it into PEM before uploading it.

Typical Application Scenarios

  • Common Internet service websites: If you want to connect a domain name to WAF for HTTPS protection, purchase a certificate from a third-party CA. After obtaining the PEM certificate and private key locally, you need to manually upload them to WAF and then associate them with the protected website.
  • Certificates managed in Huawei Cloud SCM: If you have purchased and uploaded a certificate in SCM and your service is in the default enterprise project, you can directly push the certificate to WAF without copying and pasting the certificate text.
  • Websites requiring SM series cryptographic algorithms: For government and financial services, SM series cryptographic algorithms are required. Dedicated WAF instances are deployed in CN North-Ulanqab1. You can upload two SM cryptographic certificates (one for signature and the other for encryption) and their private keys.
  • Certificate renewal upon expiration: If the old certificate is about to expire, obtain a new certificate and replace the old certificate in the certificate management list.

Differences Between Manually Uploading a Certificate and Pushing a Certificate Using SCM

When binding a website to WAF, you can manually upload a certificate or push a certificate using SCM. Table 1 describes the differences between different methods of obtaining a certificate.

Table 1 Differences between manually uploading a certificate and pushing a certificate using SCM

Item

Manually Uploading a Certificate

Pushing a Certificate Using SCM

Certificate source

Third-party CAs and local certificate files

SSL Certificate Manager (SCM) in Cloud Certificate & Manager (CCM)

Operation method

Push a certificate from Cloud Certificate & Manager (CCM) to WAF in one click. For details, see Pushing an SSL Certificate to Other Cloud Services.

Enterprise project restrictions

All enterprise projects are supported.

Only the default enterprise project is supported. For other enterprise projects, SSL certificates pushed by SCM cannot be used.

Certificate lifecycle management

WAF only stores certificates. You need to configure expiration notifications by yourself. For details, see Enabling Alarm Notifications.

CCM centrally manages certificate expiration, renewals, and updates.

Certificate statistics

Each certificate added to the certificate list on the Certificates page is counted towards the certificate quota.

Each certificate added to the certificate list on the Certificates page is counted towards the certificate quota.

Specification Limitations

You can upload as many certificates in WAF as the number of domain names that can be protected by your WAF instances in the same account.

For example, if you purchase a standard edition WAF instance, which can protect 20 domain names, and a domain name expansion package, which can protect 20 domain names, your WAF instance can protect 40 domain names total. In this case, you can upload 40 certificates.

Constraints

  • The certificate must be in PEM. If the certificate is not in PEM, convert it to PEM first.
  • By default, the certificate and private key matching verification is enabled for international certificates. If the certificate and private key do not match, the upload fails.
  • The certificate name must be unique in the current enterprise project.

Prerequisites

  • You have obtained the certificate file and private key, and the certificate matches the private key.
  • You have used OpenSSL to convert non-PEM certificates to PEM. For details, see Converting Certificate Formats.

Uploading a Certificate to WAF

  1. Log in to the WAF console.
  2. Click in the upper left corner and select a region or project.
  3. (Optional) If you have enabled the enterprise project function, in the upper part of the navigation pane on the left, select your enterprise project from the Filter by enterprise project drop-down list. Then, WAF will display the related security data in the enterprise project on the page.
  4. In the navigation pane on the left, choose Objects > Certificates.
  5. Above the certificate list, click Add Certificate.
  6. On the Add Certificate panel, configure the following parameters and click OK.

    Table 2 Adding an international certificate.

    Parameter

    Description

    Example Value

    Certificate Type

    Select the type of the certificate to be added. Select International.

    Chinese

    Certificate Name

    Enter a certificate name.

    waf_international

    Certificate File

    Public key certificate file, which is in PEM format and contains public information such as the public key, protected domain name, validity period, and CA. WAF delivers the certificate to the client during an HTTPS handshake for site identity verification and key encryption.

    Open the .pem file in the certificate you want to add as a text file and copy the certificate content in the file to the text box.

    -----BEGIN CERTIFICATE-----

    MIIDIjCCAougAwIBAgIJALV96mEtVF4EMA0GCSqGSIb3DQEBBQUAMGoxCzAJBgNVBAYTAnh4MQswCQYDVQQIEwJ4eDELMAkGA1UEBxMCeHgxCzAJBgNVBAoTAnh4MQswCQYDVQQLEwJ

    -----END CERTIFICATE-----

    Private Key

    Private key paired with the certificate file. The private key is in PEM format and stored in WAF. It is used to decrypt the session key and handshake signature. It is highly sensitive information and must be kept confidential. The certificate file must match the private key. Otherwise, the upload will fail.

    Open the .key file in the certificate you want to add as a text file and copy the private key in the file to the text box.

    -----BEGIN RSA PRIVATE KEY-----

    MIICXQIBAAKBgQDFPN9ojPndxSC4E1pqWQVKGHCFlXAAGBOxbGfSzXqzsoyacotueqMqXQbxrPSQFATeVmhZPNVEMdvcAMjYsV/mymtAwVqVA6q/OFdX/b3UHO+b/VqLo3J5SrM

    -----END RSA PRIVATE KEY-----

    Check whether the certificate matches the private key.

    Select this option. If the certificate does not match the private key, click Why Does My Certificate Not Match the Private Key?

    -

Operation Result Verification

After completing the preceding configurations, you can check whether the certificate is available in the following ways:

  • Verify the certificate on the console. In the certificate list, locate the uploaded certificate and click View in the Operation column. Check whether the certificate type, certificate file, and certificate private key are as expected.
  • Verify the domain name associated with a certificate. After associating the certificate with the domain name, access "https://{Domain name}" using a browser, and check the lock icon in the address bar and click it to check whether the certificate authority, domain name, and validity period match the expected information.
  • Verify the certificate using a command line tool (recommended for O&M)
    bash
    openssl s_client -connect Domain name:443 -servername Domain name

    Check the subject, issuer and notAfter fields in the command output and ensure that the domain name, issuer, and expiration time are correct and no certificate chain error is reported.

Related Operations

  • To change the certificate name, move the cursor over the name of the certificate, click , and enter a new certificate name.

    If the certificate is in use, unbind the certificate from the domain name first. Otherwise, the certificate name cannot be changed.

  • To view details about a certificate, click View in the Operation column of the certificate.
  • To use a certificate for the corresponding domain name, click Use in the Operation column of the certificate.
  • To delete a certificate, click More > Delete in the Operation column of the certificate.
    • Before deleting a certificate, ensure that the certificate is not used for any domain name. If the certificate is still used for a domain name, deleting it will cause the domain name to lose the HTTPS certificate and HTTPS service access will be abnormal. If you are sure that you want to delete the certificate, delete it from the domain name first.
    • Deleted certificates cannot be restored. Before deleting a certificate, ensure that it is no longer used by any protected domain name. If a certificate is deleted mistakenly, you need to upload the certificate file again.
  • To update a certificate, click More > Update in the Operation column of the certificate.
  • To share a certificate with other enterprise projects, click More > Share in the Operation column of the certificate.
  • To stop sharing a certificate with other enterprise projects, click More > Stop Sharing in the Operation column of the certificate.
  • To convert a certificate format, see Table 3. WAF supports only certificates in PEM format. If a certificate is not in PEM format, convert before uploading it.
    • Before running an OpenSSL command, ensure that the OpenSSL tool has been installed on the local host.
    • If your local PC runs a Windows operating system, go to the command line interface (CLI) and then run the certificate conversion command.
    Table 3 Certificate conversion commands

    Format

    Conversion Method

    CER/CRT

    Rename the cert.crt certificate file to cert.pem.

    PFX

    • Obtain a private key. For example, run the following command to convert cert.pfx into key.pem:

      openssl pkcs12 -in cert.pfx -nocerts -out key.pem -nodes

    • Obtain a certificate. For example, run the following command to convert cert.pfx into cert.pem:

      openssl pkcs12 -in cert.pfx -nokeys -out cert.pem

    P7B

    1. Convert a certificate. For example, run the following command to convert cert.p7b into cert.cer:

      openssl pkcs7 -print_certs -in cert.p7b -out cert.cer

    2. Rename certificate file cert.cer to cert.pem.

    DER

    • Obtain a private key. For example, run the following command to convert privatekey.der into privatekey.pem:

      openssl rsa -inform DER -outform PEM -in privatekey.der -out privatekey.pem

    • Obtain a certificate. For example, run the following command to convert cert.cer into cert.pem:

      openssl x509 -inform der -in cert.cer -out cert.pem

FAQ