How to Create a Self-Signed HTTPS Certificate and Apply It to Wowza
To send an HTTPS HLS stream, the streaming program must trust the server’s self-signed certificate. This article explains how to create a certificate and private key with Python and how to register the certificate in the Java cacerts used by Wowza Streaming Engine.
HTTPS Certificates and HLS
HLS is a streaming method that uses HTTP, which is widely used for web services, to send video data and playlists.
Several security problems arose with HTTP, which has been used since the early days of the Internet. HTTPS became widely used to address these problems. It is now the standard method for modern Internet transmission. HTTPS encrypts transmitted data with a key. It uses a certificate to verify the identity of the other party. This improves the reliability of the communication.
These security measures are very helpful in a real service environment, but not in a development environment. A certificate in a test environment is not officially registered. This causes problems in the verification process and makes integration fail.
Therefore, in a test environment where a publicly trusted certificate cannot be used, you must create a self-signed certificate and private key and apply them to the test server. You must also separately register the certificate so that the connecting program trusts it.
This article explains how to use Python to create a self-signed certificate and private key for a private HLS PUSH server such as PushCap. It also explains how to register the certificate in the Java trust store used by Wowza Streaming Engine (hereafter called WSE), and send an HTTPS HLS PUSH stream.
How to Create a Certificate with Python
Prepare the Python Environment
- Install Python
This example uses Python. Therefore, Python must be installed on the PC where you will create the key and certificate.
- Install the additional package
Use the following command to install the
cryptographypackage required to run the program.py -m pip install cryptography
Create the Program File
Create a suitable directory. Copy the code below and save it as GenCert.py.
from cryptography import x509
from cryptography.x509.oid import NameOID
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
import datetime
# Enter the domain name here. This is the address entered in the streaming program.
domain_name = u"b.upload.youtube.com"
# 1. Create a private key
key = rsa.generate_private_key(
public_exponent=65537,
key_size=2048,
)
# 2. Save the private key to a file (key.pem)
with open("key.pem", "wb") as f:
f.write(key.private_bytes(
encoding=serialization.Encoding.PEM,
format=serialization.PrivateFormat.TraditionalOpenSSL,
encryption_algorithm=serialization.NoEncryption(),
))
# 3. Set the certificate information for self-signing (change the Common Name)
subject = issuer = x509.Name([
x509.NameAttribute(NameOID.COUNTRY_NAME, u"KR"),
x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, u"Jeju-do"),
x509.NameAttribute(NameOID.LOCALITY_NAME, u"Mola-si"),
x509.NameAttribute(NameOID.ORGANIZATION_NAME, u"EQMaker"),
x509.NameAttribute(NameOID.COMMON_NAME, domain_name),
])
# 4. Create and sign the certificate
cert = x509.CertificateBuilder().subject_name(
subject
).issuer_name(
issuer
).public_key(
key.public_key()
).serial_number(
x509.random_serial_number()
).not_valid_before(
datetime.datetime.now(datetime.timezone.utc)
).not_valid_after(
datetime.datetime.now(datetime.timezone.utc) + datetime.timedelta(days=365)
).add_extension(
x509.SubjectAlternativeName([x509.DNSName(domain_name)]),
critical=False,
).sign(key, hashes.SHA256())
# 5. Save the certificate to a file (cert.pem)
with open("cert.pem", "wb") as f:
f.write(cert.public_bytes(serialization.Encoding.PEM))
print(f"'{domain_name}' cert.pem / key.pem created.")
Replace b.upload.youtube.com with the host name of the HTTPS URL you want to use. In other words, the server with this certificate claims that it is b.upload.youtube.com.
Create the Certificate
In a console window, move to the directory that contains GenCert.py. Run the code. If the message created appears as shown below, the cryptographic key and certificate were created successfully.
Microsoft Windows [Version 10.0.20348.4052] (c) Microsoft Corporation. All rights reserved. D:\>cd HLSWEB D:\HLSWEB>py GenCert.py 'b.upload.youtube.com' cert.pem / key.pem created.
Copy the generated cert.pem and key.pem files to the directory where PushCap.py runs. If you another type of receiving server, register the certificate and key files on that server.
If you use a streaming program such as OBS that does not have a separate certificate and key verification function, you can send an HTTPS HLS stream without additional work. However, WSE verifies whether the server certificate is trusted. Because the certificate is not publicly trusted, the additional registration procedure below is required.
Apply a Private Certificate to Wowza Streaming Engine
Commercial streaming programs such as WSE may perform their own additional certificate verification. A self-signed certificate is not registered in the default trust store. Therefore, you must directly register the certificate presented by the PushCap server in WSE’s Java trust store.
Procedure for Applying a Private Certificate to Wowza Streaming Engine
- Stop the WSE service
- Open a console: Open a console, such as a DOS window, with administrator privileges.
- Move to the Java tool directory
Move to the Java tool directory installed with WSE. The default path is
[WSE default installation path]/jre/bin. The default path may differ if you use a separately installed Java version or a different WSE version. Check the path carefully. -
Register the certificate file
The
bindirectory contains an executable file namedkeytool. Enter the following command to register the certificate file.keytool -importcert -alias "[certificate name]" -keystore "[certificate store]" -storepass changeit -file "[certificate file]"- [certificate name]
- The name of the certificate to use in WSE. You may choose any name.
- [certificate store]
- The location where the certificate will be stored. It is the certificate store inside the JRE directory used by WSE. The default path is
[WSE installation path]\jre\lib\security\cacerts. - [certificate file]
- The path and file name of the certificate file (
.pem) to register
changeitis the initial password of the Javacacertstrust store. If the administrator changed the password, enter the actual password instead.
Example of Applying and Verifying a Certificate in Wowza Streaming Engine
The following is an actual example of applying a private certificate to WSE on Windows. The environment is as follows.
- Operating system
- Windows Server 2022
- WSE version
- 4.8.25+2
- Certificate file path
D:\HLSWEB\cert.pem
- Open a console window, such as a DOS window, with administrator privileges.
-
Stop the WSE service
C:\>sc stop WowzaStreamingEngine4825+2 SERVICE_NAME: WowzaStreamingEngine4825+2 TYPE : 10 WIN32_OWN_PROCESS STATE : 3 STOP_PENDING (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x7d0 - Register the certificate
C:\>Program Files\Wowza Media Systems\Wowza Streaming Engine 4.8.25+2\jre\bin>keytool.exe -importcert -alias "YouTubeLocal" -keystore "C:\Program Files\Wowza Media Systems\Wowza Streaming Engine 4.8.25+2\jre\lib\security\cacerts" -storepass changeit -file "D:\HLSWEB\cert.pem" Warning: use -cacerts option to access cacerts keystore Owner: CN=b.upload.youtube.com, O=EQMaker, L=Mola-si, ST=Jeju-do, C=KR Issuer: CN=b.upload.youtube.com, O=EQMaker, L=Mola-si, ST=Jeju-do, C=KR Serial number: 389c81b7d9e5452c8cbace6436a99aff004376 Valid from: Mon Aug 25 23:34:59 KST 2025 until: Tue Aug 25 23:34:59 KST 2026 Certificate fingerprints: SHA1: AA:BB:CC:DD:EE:00:AA:BB:CC:DD:EE:00:65:33:A0:A8:44:55:C0:54 SHA256: AA:BB:CC:DD:EE:00:AA:BB:CC:DD:EE:FF:00:AA:BB:CC:DD:EE:25:9E:AD:00:54:DE:D0:AE:52:97:1C:A1:85:59 Signature algorithm name: SHA256withRSA Subject Public Key Algorithm: 2048-bit RSA key Version: 3 Extensions: #1: ObjectId: 2.5.29.17 Criticality=false SubjectAlternativeName [ DNSName: b.upload.youtube.com ] Trust this certificate? [no]: yes Certificate was added to keystore - Verify the certificate registration
C:\Program Files\Wowza Media Systems\Wowza Streaming Engine 4.8.25+2\jre\bin>keytool -list -cacerts Enter keystore password:Enter ***************** WARNING WARNING WARNING ***************** * The integrity of the information stored in your keystore * * has NOT been verified! In order to verify its integrity, * * you must provide your keystore password. * ***************** WARNING WARNING WARNING ***************** Keystore type: JKS Keystore provider: SUN Your keystore contains 93 entries ... (earlier lines omitted) ... youtubelocal, 2025 Aug 26, trustedCertEntry, Certificate fingerprint (SHA-256): AA:BB:CC:DD:EE:00:AA:BB:CC:DD:EE:FF:00:AA:BB:CC:DD:EE:25:9E:AD:00:54:DE:D0:AE:52:97:1C:A1:85:59 ... (omitted) ...
If a certificate with the registered name, youtubelocal in this example, exists as shown above, it was registered successfully.
- Restart the WSE service
C:\>sc start WowzaStreamingEngine4825+2 SERVICE_NAME: WowzaStreamingEngine4825+2 TYPE : 10 WIN32_OWN_PROCESS STATE : 2 START_PENDING (NOT_STOPPABLE, NOT_PAUSABLE, IGNORES_SHUTDOWN) WIN32_EXIT_CODE : 0 (0x0) SERVICE_EXIT_CODE : 0 (0x0) CHECKPOINT : 0x0 WAIT_HINT : 0x7d0 PID : 4356 FLAGS :
FAQ
- Why is a certificate needed for HLS transmission?
-
HLS itself does not always require a certificate. However, a transmission that uses HTTPS, such as YouTube HLS PUSH, needs a certificate to verify the server’s identity and encrypt the data. A certificate is not needed if only HTTP is used, but the communication is not encrypted.
- What is the difference between a private certificate and a publicly trusted certificate?
-
A publicly trusted certificate is issued by a public certificate authority that operating systems and programs trust by default. A private certificate is self-signed or issued by an internal certificate authority. Therefore, it must be separately registered as trusted in the connecting program. The main difference between the two certificates is their default trust status, not their encryption function.
- What is the difference between a key and a certificate?
-
A private key is secret information that a server uses to prove ownership and set up TLS communication. It must not be made public. A certificate contains information such as the server name, public key, issuer, and validity period. It is presented to the connecting program. The certificate and private key must be a matching pair.
- Can HTTPS transmission work with only a key and no certificate?
-
This is not possible in normal HTTPS communication. The server must use a certificate and its matching private key together. With only a private key, the client cannot verify the identity of the server. Therefore, it cannot operate as a normal HTTPS server.
- Can a certificate be issued for an IP address instead of a domain address?
-
Yes. A certificate for an IP address must record the IP address in the SAN instead of a domain name. In the Python
cryptographypackage, usex509.IPAddress()instead ofx509.DNSName(). However, it is difficult to issue a publicly trusted certificate for a private IP address, and the address may change. Therefore, it is mainly used in a fixed test environment or an internal system. - Does Wowza Streaming Engine have certificates for every platform?
-
No. The Java trust store used by WSE does not contain the certificates of every server. It contains the root and intermediate certificates of major trusted certificate authorities. WSE checks whether the certificate presented by the server can be verified through this trust system. A self-signed certificate must be registered separately.
- Why is only the certificate registered in Wowza, not the private key?
-
The private key must be kept by
PushCap, the HTTPS receiving server. WSE is a client that connects to that server. It only needs to register the certificate presented by the server in its trust store. Do not register or sendkey.pemto WSE’scacerts. - Does creating a certificate automatically send traffic for that domain to the test server?
-
No. A certificate only identifies and verifies the server. It does not change the network route. To send requests for
b.upload.youtube.comtoPushCap, map the destination to the IP address of the test server. Do this in the hosts file of the streaming device, internal DNS, or a separate proxy. - Can the existing registration still be used if the certificate expires or is regenerated?
-
No. A newly created certificate has a different public key and fingerprint from the existing certificate. Therefore, it must be registered again in WSE’s trust store. If the same alias already exists, delete the existing entry or use a different alias. Then restart the WSE service.
- How can I check whether the certificate is correctly registered in Wowza?
-
Use the
keytool -list -cacertscommand in the JRE used by WSE. Check the alias and fingerprint of the registered certificate. To verify the integrity of the store, do not simply press Enter at the password prompt. Enter the actualcacertspassword. After registration, restart the WSE service to apply the change.
Update History
- — First published
- — Revision and URL migration