One Click Multi DRM overview

Prev Next

Overview

One Click Multi DRM provides a content security service with high performance and stability in cooperation with DoveRunner (formerly PallyCon), which has been proven both domestically and internationally.
By supporting standard DRMs such as Widevine, FairPlay, and PlayReady, you can apply strong security to any video without operating system or platform barriers. By integrating with NAVER Cloud Platform's media streaming services, you can easily build an encrypted streaming service without going through complicated procedures.
DRM can be applied through simple integration flows with Live Station and VOD Station (scheduled for 2024), which are media streaming services of the NAVER Cloud Platform.

Common attributes

One Click Multi DRM API URL

https://multi-drm.apigw.ntruss.com/api/v1

Request headers

Header name Required Description
x-ncp-apigw-timestamp YES It indicates the time elapsed since January 1, 1970 00:00:00 UTC in milliseconds, and request is considered invalid if the timestamp differs from the current time by more than 5 minutes.
x-ncp-apigw-timestamp:{Timestamp}
x-ncp-iam-access-key YES Value of access key ID issued in the NAVER Cloud Platform portal
x-ncp-iam-access-key:{Sub Account Access Key}
x-ncp-apigw-signature-v2 YES Signature encrypted with the access key ID value and secret key
x-ncp-apigw-signature-v2:{API Gateway Signature}
Content-Type YES Specify the request body content type as application/JSON.
Content-Type: application/json
x-ncp-region_code YES Region code (KR)

Authentication header

API Gateway authentication is required to use the One Click Multi DRM API.

See NAVER Cloud Platform API for more detailed guides related to API Gateway authentication.

Create AUTHPARAMS

AUTHPARAMS request example

curl -i -X GET \
   -H "x-ncp-apigw-timestamp:1505290625682" \
   -H "x-ncp-iam-access-key:D78BB444D6D3C84CA38A" \
   -H "x-ncp-apigw-signature-v2:WTPItrmMIfLUk/UyUIyoQbA/z5hq9o3G8eQMolUzTEo=" \
   -H "x-ncp-region_code:KR" \
'https://multi-drm.apigw.ntruss.com/api/v2/sites'
  • Create a signature (add a new line with \n)

    • Create StringToSign matching the request, encrypt using SecretKey with HmacSHA256 algorithm, and encode using Base64.

    • This value is used as x-ncp-apigw-signature-v2.

      Request StringToSign
      GET /api/v2/channels?pageNo=1
      x-ncp-apigw-timestamp={timestamp}
      x-ncp-iam-access-key={accesskey}
      x-ncp-apigw-signature-v2={signature}
      GET /api/v2/channels?pageNo=1
      {timeStamp}
      {accessKey}
  • Sample code

public String makeSignature() {
    String space = " ";					// Space
    String newLine = "\n";  				// Line break
    String method = "GET";  				// HTTP method
    String url = "/api/v2/channels?pageNo=1";	// Full URL under "/" (including query strings), excluding the domain
    String accessKey = "{accessKey}";		// access key id (from portal or Sub Account)
    String secretKey = "{secretKey}";		// secret key (from portal or Sub Account)
    String timestamp = String.valueOf(System.currentTimeMillis());		// Current timestamp (epoch, millisecond)

    String message = new StringBuilder()
        .append(method)
        .append(space)
        .append(url)
        .append(newLine)
        .append(timestamp)
        .append(newLine)
        .append(accessKey)
        .toString();

    SecretKeySpec signingKey = new SecretKeySpec(secretKey.getBytes("UTF-8"), "HmacSHA256");
    Mac mac = Mac.getInstance("HmacSHA256");
    mac.init(signingKey);

    byte[] rawHmac = mac.doFinal(message.getBytes("UTF-8"));
    String encodeBase64String = Base64.encodeBase64String(rawHmac);

  return encodeBase64String;
}
/*
https://code.google.com/archive/p/crypto-js/
https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/crypto-js/CryptoJS%20v3.1.2.zip
*/

/*
CryptoJS v3.1.2
code.google.com/p/crypto-js
(c) 2009-2013 by Jeff Mott. All rights reserved.
code.google.com/p/crypto-js/wiki/License
*/



function makeSignature(secretKey, method, url, timestamp, accessKey) {
	var space = " ";
	var newLine = "\n";

	var hmac = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, secretKey); // secret key
	hmac.update(method);		// HTTP method
	hmac.update(space);		// Space
	hmac.update(url);		// Full URL under "/" (including query strings), excluding the domain
	hmac.update(newLine);		// Line break
	hmac.update(timestamp);		// Current timestamp (epoch, millisecond)
	hmac.update(newLine);		// Line break
	hmac.update(accessKey);		// access key (from portal or iam)

	var hash = hmac.finalize();

	return hash.toString(CryptoJS.enc.Base64);
}
import sys
import os
import hashlib
import hmac
import base64
import requests
import time

def	make_signature():
	timestamp = int(time.time() * 1000)
	timestamp = str(timestamp)				# Current timestamp (epoch, millisecond)

	access_key = "{accessKey}"				# access key id (from portal or Sub Account)
	secret_key = "{secretKey}"				# secret key (from portal or Sub Account)
	secret_key = bytes(secret_key, 'UTF-8')

	method = "GET"						# HTTP method
	uri = "/api/v2/channels?pageNo=1"			# Full URL under "/" (including query strings), excluding the domain

	message = method + " " + uri + "\n" + timestamp + "\n"
	+ access_key
	message = bytes(message, 'UTF-8')
	signingKey = base64.b64encode(hmac.new(secret_key, message, digestmod=hashlib.sha256).digest())
	return signingKey
function makeSignature() {
	nl=$'\\n'

	TIMESTAMP=$(echo $(date +%s000))	# Current timestamp (epoch, millisecond)
	ACCESSKEY="{accessKey}"				# access key id (from portal or Sub Account)
	SECRETKEY="{secretKey}"				# secret key (from portal or Sub Account)
	METHOD="GET"					# HTTP method
	URI="/api/v2/channels?pageNo=1"		# Full URL under "/" (including query strings), excluding the domain

	SIG="$METHOD"' '"$URI"${nl}
	SIG+="$TIMESTAMP"${nl}
	SIG+="$ACCESSKEY"

	SIGNATURE=$(echo -n -e "$SIG"|iconv -t utf8 |openssl dgst -sha256 -hmac $SECRETKEY -binary|openssl enc -base64)
}

One Click Multi DRM API request configuration

Header
  x-ncp-apigw-timestamp:{Timestamp}
  x-ncp-iam-access-key:{Sub Account Access Key}
  x-ncp-apigw-signature-v2:{API Gateway Signature}
  x-ncp-region_code:KR
  Content-Type:application/json
Body
  Json Object
URL
  https://multi-drm.apigw.ntruss.com/api/v1/{action}

One Click Multi DRM API request sample

curl -i -s -X GET \
   -H "Content-Type:application/json" \
   -H "x-ncp-apigw-timestamp:1521787414578" \
   -H "x-ncp-iam-access-key:6uxz1nKkcYwUjWRG5Q1V7NsW0i5jErlu2NjBXXgy" \
   -H "x-ncp-apigw-signature-v2:iJFK773KH0WwQ79PasqJ+ZGixtpDQ/abS57WGQdld2M=" \
   -H "x-ncp-region_code:KR" \
   "https:///multi-drm.beta-apigw.ntruss.com/api/v1/sites"

One Click Multi DRM API Content-Type

application/json is used for the Content-type of all data delivered through Multi DRM API HTTP requests and response bodies.