CnL Script

This page provides an easy to use JDownloader Click'n'Load script

How to use

Javascript File

Add this script to all pages that display CnL elements:
<script type="text/javascript" src="https://cable.ayra.ch/cnl/cnl.js" identity="sha384-ayEXRe4EScKhe/GKUpBZ+BXn8R/kYZXSseaw1mosahLALvvYevgrzGXzTjwlTg7l" crossorigin="anonymous"></script>
You can upload a copy of this script to your own server if you prefer. It doesn't depends on any other component.
The script will scan the entire page for CnL buttons and add event handlers. The button needs to be present when the DOMContentLoaded event is fired.

CnL Button

To initiate a CnL element, place a button on your page like this:
<input type="button" value="Download" data-cnl-crypted="DATA" data-cnl-jk="LINK-PASSWORD" data-cnl-password="ARCHIVE-PASSWORD" />
Replace the values as needed.
You can have as many buttons as you want on a single page. You are not bound to use buttons at all and can add the data-cnl-* attributes to any element you like.
Description of Attributes:

Encrypt Links

If you need a script to generate password and links, you can use the PHP file below. Just call cnl_create with an array of all links to protect and you get an array returned which contains values for the two important button data values.

<?php
    
//Pad CnL Links as needed with zeros
    
function cnl_pad_r($data){
        
//Be sure we pad at least one block
        
if(strlen($data)%16===0){
            
$data.="\0";
        }
        while(
strlen($data)%16!=0){
            
$data.="\0";
        }
        return 
$data;
    }
    
    
//Converts links into CnL format.
    //$links: Array of URLs
    //Returns: Array with values for "jk" and "crypted"
    
function cnl_create($links){
        
$key=random_bytes(16);
        
$data=implode("\r\n",$links);
        return array(
            
"jk"=>bin2hex($key),
            
"crypted"=>base64_encode(openssl_encrypt(cnl_pad_r($data),"AES-128-CBC",$key,OPENSSL_RAW_DATA|OPENSSL_NO_PADDING,$key))
        );
    }
    
    
//Decrypts CnL links for debugging. 
    //$key: Password
    //$data: Data (base64 encoded)
    //Returns: Array of decrypted links
    
function cnl_decrypt($key,$data){
        if(
strlen($key)===32){
            
$key=hex2bin($key);
        }
        return 
explode("\r\n",rtrim(openssl_decrypt(base64_decode($data),"AES-128-CBC",$key,OPENSSL_RAW_DATA|OPENSSL_NO_PADDING,$key)));
    }

Encryption Details

Separate all links using CRLF (\r\n) in a single string and encrypt this string using Type=aes128 Mode=cbc Padding=zero.
The key must be exactly 16 bytes in length and is used as the initialization vector too.
If your library doesn't supports zero padding you have to implement it yourself.

Note

Link containers and CnL are horribly broken. We recommend that you offer the links in an unencrypted format too because it has been become trivial to decrypt these containers and they are no benefit to the user.
All link containers, including the "dlc" format have been bypassed. You can find a decrypter here. We plan on adding a CnL module too.

Demo

The encrypted links are all non-functional for this demo.

Links we encrypted for this demo