DRM-X 5.0 Encryption SDK User Guide
For technical staff — how to encrypt videos by invoking the encryption tool from the command line on your own server / website
Applies to: DRM-X 5.0 (International edition com / China edition cn) · Platforms: Windows / Linux x86_64 / macOS 11.0+
Table of Contents
1SDK Package Contents
After extracting the DRM-X5.0_Encryption_SDK archive, the directory contains the following files:
| File | Description |
|---|---|
| drm-x5-encrypt-sdk.exe | Windows encryption program (x64) |
| drm-x5-encrypt-sdk-linux-x86_64 | Linux encryption program (x86_64, statically linked — no shared-library dependencies; runs directly on CentOS / Ubuntu, etc.) |
| drm-x5-encrypt-sdk-macos-x86_64 | macOS encryption program (Intel chip, macOS 11.0 or later) |
| drm-x5-encrypt-sdk-macos-arm64 | macOS encryption program (Apple Silicon M-series chip, macOS 11.0 or later) |
| cmd.txt | Command-line invocation examples for the three platforms |
| GetPackagerEncryptedParams.php | A runnable PHP demo that calls the Web Service to obtain the encryption parameters (see Section 4.4) |
The command-line arguments are identical across all three platforms — only the program file name differs.
2Encryption Workflow Overview
STEP 1 · Obtain encryption parameters
Call GetPackagerEncryptedParams to obtain ProfileEncryptedParam (i.e. the -profile encrypted string — fetch it once and cache it for reuse). The Base64 values of the input / output paths are encoded locally by your program; there is no need to call the Web Service for them.
STEP 2 · Assemble the command line
Fill the obtained -profile and the locally Base64-encoded paths into the encryption program's four arguments: -server_domain / -profile / -input_file_utf8_base64_encoded / -output_file_utf8_base64_encoded
STEP 3 · Run the encryption
Execute the command-line program on your server to perform the encryption.
STEP 4 · Publish the encrypted files
Upload / publish the encrypted files from the output directory. Licenses are issued by the DRM-X 5.0 server when users play the content.
Why call the DRM-X 5.0 Web Service first?The encryption program's -profile argument is not the numeric ID of the license profile — it is an encrypted string bound to your account (ProfileEncryptedParam). This string cannot be generated locally; it can only be obtained through the Web Service. It maps one-to-one to a ProfileID, and once obtained it can be cached and reused — you do not need to call the Web Service for every file. The Base64 values of the input / output paths, on the other hand, should be encoded locally in your program (see Section 6) — no Web Service call needed for them.
3Prerequisites
3.1 DRM-X 5.0 Account Information (obtained from the DRM-X admin console)
| Item | Purpose |
|---|---|
| AdminEmail | Administrator email address, used for Web Service authentication. Requires an Advanced account or higher. |
| WebServiceAuthStr | Web Service integration auth string. View it in the admin console under "Website Integration Parameter Settings". |
| ProfileID | Numeric license profile ID — specifies which license profile is used for this encryption. |
3.2 Server Environment Requirements
| Platform | Requirements |
|---|---|
| Windows | Windows 7 / Server 2008 R2 or later (x64) |
| Linux | x86_64 architecture (CentOS 7+ / Ubuntu 16.04+ and other mainstream distributions). Statically linked — no dependencies to install. |
| macOSmacOS | macOS 11.0 or later, Intel or Apple Silicon chip |
| Server-side integration (optional) | PHP 7.4+ (with the soap and openssl extensions enabled), for automatically calling the Web Service |
Security reminder: WebServiceAuthStr is equivalent to an account key. It must be stored server-side only — never place it in front-end web pages, client software, or public repositories.
4Step One: Call the DRM-X 5.0 Web Service to Obtain Encryption Parameters
4.1 Web Service Information
| Item | Value |
|---|---|
| International endpoint | https://5.drm-x.com/haihaisoftlicenseservice.asmx |
| Chinese endpoint | https://5.drm-x.cn/haihaisoftlicenseservice.asmx |
| Method name | GetPackagerEncryptedParams |
| Protocol | SOAP 1.1 (POST) |
| SOAPAction | http://tempuri.org/ASPNET.StarterKit.Commerce/HaihaisoftLicenseService/GetPackagerEncryptedParams |
The endpoint must match your account's edition: International accounts use 5.drm-x.com (command line: -server_domain com); China accounts use 5.drm-x.cn (command line: -server_domain cn). Using the wrong edition will cause authentication to fail, or the encrypted files to be unplayable.
4.2 Request Parameters
| Parameter | Required | Description |
|---|---|---|
| AdminEmail | Yes | DRM-X 5.0 administrator email address |
| WebServiceAuthStr | Yes | Web Service auth string |
| ProfileID | Yes | License profile ID (numeric; no encoding needed) |
| Input | Yes | Full path of the file to be encrypted (plain string; no encoding needed) |
| Output | Yes | Full path of the encrypted output file |
| ProfileEncryptedParam / enc_Input / enc_Output | No | Reserved fields — normally pass an empty string |
4.3 Mapping Between Response Fields and Command-Line Arguments (Core)
| Response field | Command-line argument | Description |
|---|---|---|
| ProfileEncryptedParam | -profile | An encrypted license-profile string bound to your account (URL-Safe Base64, containing - and _). You must use the value returned by the Web Service — never pass the numeric Profile ID, and never encode it yourself. It only needs to be fetched once per ProfileID and can then be cached and reused long-term — there is no need to call the Web Service for every file. |
| enc_Input | -input_file_utf8_base64_encoded | The UTF-8 Base64-encoded input path. Encoding it locally in your program is recommended (PHP: base64_encode(); in other languages, convert to UTF-8 bytes first, then Base64 — see Section 6). No Web Service call is needed for this; the enc_Input value returned by the service works just as well. |
| enc_Output | -output_file_utf8_base64_encoded | The UTF-8 Base64-encoded output path. Encoding it locally is recommended (same method as above); the enc_Output value returned by the service also works. |
| GetPackagerEncryptedParamsResult | — | Status / message text. Note: |
4.4 Invocation Example (PHP / SoapClient)
This Web Service is a standard SOAP 1.1 service that can be called from any language, in the same uniform way: POST a SOAP envelope to the endpoint listed in 4.1 (or have a SOAP client generate it automatically from ?WSDL), pass the parameters from 4.2, then read the three fields from 4.3 in the response. Common SOAP client libraries by language:
| Language / Platform | Common SOAP clients |
|---|---|
| PHP | Built-in SoapClient class (used in this guide, WSDL mode) |
| Java | JAX-WS (wsimport), Apache Axis2, Apache CXF |
| Python | zeep、suds |
| C# / .NET | Visual Studio "Add Service Reference", or SvcUtil |
| Node.js | soap package |
The following example uses PHP's SoapClient to demonstrate the full call. Save the code as get_params.php on your server and run it (PHP 7.4+ with the soap extension enabled) — it prints the three command-line argument values:
SoapClient notes:
- The php-soap extension must be installed and enabled (on Windows, uncomment extension=soap in php.ini; on Linux, install the php-soap package).
- Business errors such as failed authentication do NOT throw a SoapFault. The service still returns HTTP 200 with a well-formed response, and the error text is in GetPackagerEncryptedParamsResult. Always determine success by checking the field values as described in 4.3.
- For debugging, use var_dump($client->__getLastRequest()); to inspect the actual request envelope.
5Step Two: Run the Encryption Command
5.1 First Use (Linux / macOS)
In a terminal, change into the program's directory and grant execute permission first:
5.2 Single-File Encryption Command Templates
Windows (cmd / PowerShell):
Linux:
macOS:
5.3 Argument Reference
| Argument | Description |
|---|---|
| -server_domain | Target DRM-X 5.0 server edition: com = International, cn = China. It must match your account's platform and the Web Service endpoint used in Step 4. |
| -profile | The encrypted license-profile string — the complete ProfileEncryptedParam value returned by the Web Service (URL-Safe Base64, containing - and _). Do not pass a numeric ID, do not Base64-encode it yourself, and do not add or remove trailing characters. It only needs to be fetched once per ProfileID and can then be cached and reused long-term. |
| -input_file_utf8_base64_encoded | The UTF-8 Base64-encoded input file path. Encoding it locally is recommended (e.g. PHP's base64_encode($path), see Section 6); the enc_Input value returned by the service also works. Both absolute and relative paths are supported, and paths may contain non-ASCII characters and spaces. |
| -output_file_utf8_base64_encoded | The UTF-8 Base64-encoded output file path. Encoding it locally is recommended (same method as above); the enc_Output value returned by the service also works. The output's parent directory must already exist — the program does not create it. |
5.4 Complete Examples
Windows:
Here RDpcSmFzb25c... decodes to D:\Jason\input\01-testVideo.mp4.
Linux:
This encrypts ./input/01-linux-encrypt-video.mp4 → ./output/01-linux-encrypt-video2_P.mp4.
5.5 Verifying the Result
- When the program finishes, check that an encrypted file was created in the output directory (a _P suffix is recommended to distinguish it, e.g. course01_P.mp4);
- Encryption requires network access to the DRM-X server. Make sure your firewall / security group allows outbound access to 5.drm-x.com or 5.drm-x.cn;
- It is recommended to verify the full workflow with a small test video before batch-encrypting production content.
6Base64-Encoding the Input / Output Paths (Local Encoding Recommended)
Recommended practice: generate the values of -input_file_utf8_base64_encoded / -output_file_utf8_base64_encoded by encoding them in your own program — there is no need to call the Web Service once per file. The encoding rule: first convert the path string to UTF-8 bytes, then apply standard Base64 encoding. Note: your source files must be saved as UTF-8 (this matters especially for non-ASCII paths; on Windows, do not use ANSI / GBK encoding). Examples by language:
| Language / environment | Example (encoding the path /home/video/course01.mp4) |
|---|---|
| PHP | base64_encode('/home/video/course01.mp4') |
| Java | Base64.getEncoder().encodeToString(path.getBytes(StandardCharsets.UTF_8)) |
| Python | base64.b64encode(path.encode('utf-8')).decode() |
| C# / .NET | Convert.ToBase64String(Encoding.UTF8.GetBytes(path)) |
| Node.js | Buffer.from(path, 'utf8').toString('base64') |
| Linux / macOS shell | printf '%s' "/home/video/course01.mp4" | base64 |
| Windows PowerShell | [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes("C:\video\course01.mp4")) |
To re-emphasize: there is no way to generate the -profile argument locally. It is an encrypted string bound to your account and can only be obtained through the GetPackagerEncryptedParams Web Service.
7Server-Side Automation Examples
Chaining "obtain parameters + invoke the encryption program" enables one-click encryption from your website's back office, or scheduled batch encryption. The following PHP example invokes the Linux encryption program (continuing from the code in Section 4.4; at runtime, $profile should be read from cache first, and the Web Service in 4.4 called only when no cached value exists):
Shell batch-encryption script example (Linux — encodes paths locally, then encrypts each file):
Recommended practice: fetch the ProfileEncryptedParam for a given ProfileID once via the Web Service and cache it for reuse — do not call the Web Service once per encrypted file. Generate enc_Input / enc_Output equivalents directly by Base64-encoding (UTF-8) the paths on your server (in PHP: base64_encode($path), see Section 6) — no Web Service call needed. When batch-encrypting, limit concurrency (e.g. 2-4 encryption processes per server) to avoid saturating bandwidth and CPU.
8Frequently Asked Questions (FAQ)
Q1: The Web Service returns "Your XML web service login info is not correct..."
AdminEmail or WebServiceAuthStr is incorrect. Double-check both in the DRM-X admin console; make sure the values have no leading or trailing spaces. Also note that even for this error the HTTP status code is still 200 — your program must determine success by inspecting the response fields, not the HTTP status code.
Q2: Passing the numeric ID (e.g. 1001) directly to -profile causes an error
-profile must be the complete ProfileEncryptedParam encrypted string returned by the Web Service — not the numeric Profile ID. The numeric ID is only used when calling the Web Service.
Q3: The path contains non-ASCII characters or spaces and encryption fails?
Paths are transported as Base64, and non-ASCII characters and spaces are fully supported. The key is that encoding must use UTF-8: on Windows, Notepad / cmd may default to ANSI (GBK) encoding, which corrupts the path after Base64 decoding. Encode paths as UTF-8 in your program as described in Section 6 (with a PHP source file saved as UTF-8, plain base64_encode() works directly; legacy GBK-encoded strings can be converted first with iconv('GBK', 'UTF-8', $path) or mb_convert_encoding() before encoding).
Q4: The program reports an output failure / cannot find the output directory
The output file's parent directory must be created in advance (e.g. mkdir -p ./output). Also verify that the user running the program has write permission for that directory.
Q5: macOS says the program "cannot be opened because the developer cannot be verified"
The program is not Apple-notarized, so Gatekeeper blocks the first launch. Pick either remedy: ① Run xattr -d com.apple.quarantine ./drm-x5-encrypt-sdk-macos-arm64 in a terminal to remove the quarantine flag; ② Or click "Open Anyway" in System Settings → Privacy & Security.
Q6: On Linux the program cannot execute (Permission denied or format error)
Run chmod +x drm-x5-encrypt-sdk-linux-x86_64 first. If you get "cannot execute binary file", confirm the server is x86_64 (uname -m). The current package ships x86_64 builds only; for ARM servers please contact Haihaisoft.
Q7: Should I use com or cn? What happens if I pick the wrong one?
It must match your DRM-X account's platform: International accounts use com (and call 5.drm-x.com), China accounts use cn (and call 5.drm-x.cn). A mismatch causes authentication failure, or encryption parameters that don't match the platform.
Q8: How do I verify the encrypted files?
Open the output files in the DRM-X 5.0 demo player / your integrated player and confirm: playback is blocked without a license, and plays normally after authorizing a test user in the admin console. Verify on a small scale before bulk production encryption.
9Notes and Best Practices
- Keep the original files: write output to a new location or new file name (e.g. with a _P suffix) so the original videos are never overwritten.
- Small before large: when using a new profile or a new server for the first time, run one short test video through the whole "fetch parameters → encrypt → licensed playback" flow before batch processing.
- Never hand-edit the arguments: -profile is a Base64 encrypted string — copy it in full (no extra leading/trailing spaces, no line-wrap truncation).
- Keep the auth string secret: WebServiceAuthStr belongs in server-side configuration only; do not deploy demo web tools like GetPackagerEncryptedParams.php to the public internet.
- Network requirement: during encryption the server must reach the DRM-X servers (International 5.drm-x.com / China 5.drm-x.cn); allow outbound port 443 if a firewall is present.
Other DRM-X 5.0 Tutorials
DRM-X 5.0 Introduction VideoDRM-X 5.0 is a new generation of encryption software platform. Haihaisoft provides common DRM-X 5.0 video demo tutorials, including DRM-X 5.0 introduction, video encryption tutorial, webpage encryption tutorial, and how to embed HTML5 video player.
WATCH NOW
How to Protect Videos with DRM-X 5.0 ZJGet for WindowsThis video will demonstrate how to encrypt files on Windows using ZJGet browser.
WATCH NOW
How to Protect Videos with DRM-X 5.0 ZJGet for macOSThis video will demonstrate how to encrypt files on macOS using ZJGet browser.
WATCH NOW
Getting Started with DRM-X 5.0 ZJGet for WindowsThis video will show you how to download, install, and open encrypted files on Windows using the ZJGet browser.
WATCH NOW
DRM-X 5.0 ZJGet User GuideZJGet Browser User Guide. This tutorial will help you easily master the core features and practical tips of the ZJGet browser.
WATCH NOW
DRM-X 5.0 ZJGet FAQFrequently Asked Questions (FAQ) about using ZJGet Browser. This section compiles the most useful Q&As to help you overcome any obstacles you may encounter.
WATCH NOWQuestions?
Our reps have answers.
Ask about Haihaisoft products, pricing, implementation, or anything else — our highly trained reps are standing by, ready to help.
Tel: +64 27 507 9959 (New Zealand)
QQ: 1279126286 / 994184623
Contact us on Microsoft Teams
service#haihaisoft.com (replace # into @)
Contact Us