Package com.wowza.wms.drm.cenc
Class CencInfo
- Object
-
- com.wowza.wms.drm.cenc.CencInfo
-
- All Implemented Interfaces:
IDvrEncryptionInfo
,com.wowza.wms.httpstreamer.util.IEncryptionInfo
,Cloneable
public class CencInfo extends Object implements IDvrEncryptionInfo, com.wowza.wms.httpstreamer.util.IEncryptionInfo
-
-
Field Summary
Fields Modifier and Type Field Description static int
ALGORITHMID_CBC
static int
ALGORITHMID_CTR
static int
ALGORITHMID_NONE
static int
KEY_ROTATION_TYPE_EXTERNAL
static int
KEY_ROTATION_TYPE_INTERNAL_RANDOM
static int
KEY_ROTATION_TYPE_INTERNAL_STATIC
static int
KEY_ROTATION_TYPE_NONE
static int
PSSH_VERSION_0
static int
PSSH_VERSION_1
-
Fields inherited from interface com.wowza.wms.dvr.IDvrEncryptionInfo
ENCRYPTION_TYPE_CENC, ENCRYPTION_TYPE_CUPERTINO, ENCRYPTION_TYPE_PLAYREADY
-
-
Constructor Summary
Constructors Constructor Description CencInfo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDRM(String hashKey, ICencDRMInfo drm)
Adds a DRM system info instance to the list of DRM systems associated with the stream encryption.Object
clone()
static CencInfo
deserialize(byte[] data)
static CencInfo
deserialize(java.nio.ByteBuffer buffer)
static String
formatKID(String KID)
String
generateRandomKID()
int
getAlgorithm()
String
getAlgorithmString()
String
getCencMp4ProtSchemeString()
String
getCencMpegTsProtSchemeString()
java.util.Map<String,ICencDRMInfo>
getDRMs()
byte[]
getEncIVBytes()
byte[]
getEncKeyBytes()
java.util.List<byte[]>
getEncKeyBytesList()
String
getEncKeyString()
byte[]
getEncRepeaterBytes()
int
getEncryptionType()
Serialize encryption info.boolean
getIsRotatingKeys()
java.util.Map<Integer,com.wowza.wms.drm.cenc.CencInfo.KeyPair>
getKeyPairs()
int
getKeyRotationType()
String
getKID()
byte[]
getKIDBytes()
byte[]
getKIDBytesSwapped()
java.util.List<byte[]>
getKIDsBytesList()
java.util.List<byte[]>
getKIDsBytesListSwapped()
java.util.List<String>
getKIDsList()
String
getNameSpaceString()
int
getPSSHFlags()
int
getPSSHVersion()
int
getSerializeSize()
Return number of bytes required to serialize this encryption info.boolean
isValid()
static boolean
loadFromKeyFile(IApplicationInstance appInstance, String streamName, CencInfo cencInfo, long chunkId, int contentType, int chunkDurationTarget, String keyFileParamPrefix)
byte[]
serialize()
Serialize the encryption info, returning a byte buffer containing the serialized data.int
serialize(byte[] buffer, int pos)
Serialize the encryption info into buffer starting at position 'pos'.void
setAlgorithm(int algorithm)
Sets the encryption algorithm to be used.void
setAppInstance(IApplicationInstance appInstance)
void
setEncKeyBytes(byte[] keyBytes)
Sets the encryption content key as a byte buffer.void
setEncKeyBytesList(java.util.List<byte[]> keyBytesList)
void
setEncRepeaterBytes(byte[] encRepeaterBytes)
void
setIVBytes(byte[] encIVBytes)
void
setKeyPairs(java.util.Map<Integer,com.wowza.wms.drm.cenc.CencInfo.KeyPair> keyPairs)
void
setKeyRotationInterval(int interval)
void
setKeyRotationType(int keyRotationType)
void
setKID(byte[] KIDbytes)
Sets the encryption key id.void
setKID(String KID)
Sets the encryption key id.void
setKIDsList(java.util.List<String> KIDList)
Sets the list of encryption key id strings.void
setPSSHFlags(int psshFlags)
void
setPSSHVersion(int psshVersion)
static byte[]
swapKIDBytes(byte[] KID)
String
toString()
void
updateKey(long chunkId, int chunkDurationTarget)
-
-
-
Field Detail
-
PSSH_VERSION_0
public static final int PSSH_VERSION_0
- See Also:
- Constant Field Values
-
PSSH_VERSION_1
public static final int PSSH_VERSION_1
- See Also:
- Constant Field Values
-
ALGORITHMID_NONE
public static final int ALGORITHMID_NONE
- See Also:
- Constant Field Values
-
ALGORITHMID_CTR
public static final int ALGORITHMID_CTR
- See Also:
- Constant Field Values
-
ALGORITHMID_CBC
public static final int ALGORITHMID_CBC
- See Also:
- Constant Field Values
-
KEY_ROTATION_TYPE_NONE
public static final int KEY_ROTATION_TYPE_NONE
- See Also:
- Constant Field Values
-
KEY_ROTATION_TYPE_INTERNAL_STATIC
public static final int KEY_ROTATION_TYPE_INTERNAL_STATIC
- See Also:
- Constant Field Values
-
KEY_ROTATION_TYPE_INTERNAL_RANDOM
public static final int KEY_ROTATION_TYPE_INTERNAL_RANDOM
- See Also:
- Constant Field Values
-
KEY_ROTATION_TYPE_EXTERNAL
public static final int KEY_ROTATION_TYPE_EXTERNAL
- See Also:
- Constant Field Values
-
-
Method Detail
-
setEncKeyBytes
public void setEncKeyBytes(byte[] keyBytes)
Sets the encryption content key as a byte buffer.- Parameters:
keyBytes
- the encryption content key as a byte buffer
-
setEncKeyBytesList
public void setEncKeyBytesList(java.util.List<byte[]> keyBytesList)
-
setKeyRotationType
public void setKeyRotationType(int keyRotationType)
-
getKeyRotationType
public int getKeyRotationType()
-
getIsRotatingKeys
public boolean getIsRotatingKeys()
-
generateRandomKID
public String generateRandomKID()
-
updateKey
public void updateKey(long chunkId, int chunkDurationTarget)
-
getKeyPairs
public java.util.Map<Integer,com.wowza.wms.drm.cenc.CencInfo.KeyPair> getKeyPairs()
-
setKeyPairs
public void setKeyPairs(java.util.Map<Integer,com.wowza.wms.drm.cenc.CencInfo.KeyPair> keyPairs)
-
setKeyRotationInterval
public void setKeyRotationInterval(int interval)
-
getEncKeyBytes
public byte[] getEncKeyBytes()
- Specified by:
getEncKeyBytes
in interfacecom.wowza.wms.httpstreamer.util.IEncryptionInfo
-
getEncKeyBytesList
public java.util.List<byte[]> getEncKeyBytesList()
-
getEncKeyString
public String getEncKeyString()
-
setIVBytes
public void setIVBytes(byte[] encIVBytes)
-
getEncIVBytes
public byte[] getEncIVBytes()
- Specified by:
getEncIVBytes
in interfacecom.wowza.wms.httpstreamer.util.IEncryptionInfo
-
swapKIDBytes
public static byte[] swapKIDBytes(byte[] KID)
-
setKID
public void setKID(String KID)
Sets the encryption key id. String must be in uuid form "F6005DCF-7F93-4B8E-85C7-F977740DA059" (big endian)- Parameters:
KID
- key id
-
setKID
public void setKID(byte[] KIDbytes)
Sets the encryption key id.- Parameters:
KIDbytes
- key id byte array
-
setKIDsList
public void setKIDsList(java.util.List<String> KIDList)
Sets the list of encryption key id strings. Ids must be in uuid form "F6005DCF-7F93-4B8E-85C7-F977740DA059" (big endian)- Parameters:
KIDList
- list of key id strings
-
getKID
public String getKID()
-
getKIDBytes
public byte[] getKIDBytes()
-
getKIDBytesSwapped
public byte[] getKIDBytesSwapped()
-
getKIDsList
public java.util.List<String> getKIDsList()
-
getKIDsBytesList
public java.util.List<byte[]> getKIDsBytesList()
-
getKIDsBytesListSwapped
public java.util.List<byte[]> getKIDsBytesListSwapped()
-
getAlgorithm
public int getAlgorithm()
-
getAlgorithmString
public String getAlgorithmString()
-
setAlgorithm
public void setAlgorithm(int algorithm)
Sets the encryption algorithm to be used. Currently only CencInfo.ALGORITHMID_CTR is supported.- Parameters:
algorithm
- encryption algorithm
-
isValid
public boolean isValid()
-
getNameSpaceString
public String getNameSpaceString()
-
getCencMp4ProtSchemeString
public String getCencMp4ProtSchemeString()
-
getCencMpegTsProtSchemeString
public String getCencMpegTsProtSchemeString()
-
addDRM
public void addDRM(String hashKey, ICencDRMInfo drm)
Adds a DRM system info instance to the list of DRM systems associated with the stream encryption. The hashKey should be some unique string to identify the DRM System, such as a concatenation of the DRM system's system name and systemIdExample hashKey: "myDRM:12345678-1234-1234-1234-123456789123"
- Parameters:
hashKey
- hash keydrm
- the drm info instance
-
getDRMs
public java.util.Map<String,ICencDRMInfo> getDRMs()
-
getEncRepeaterBytes
public byte[] getEncRepeaterBytes()
-
setEncRepeaterBytes
public void setEncRepeaterBytes(byte[] encRepeaterBytes)
-
setAppInstance
public void setAppInstance(IApplicationInstance appInstance)
-
formatKID
public static String formatKID(String KID)
-
loadFromKeyFile
public static boolean loadFromKeyFile(IApplicationInstance appInstance, String streamName, CencInfo cencInfo, long chunkId, int contentType, int chunkDurationTarget, String keyFileParamPrefix)
-
getSerializeSize
public int getSerializeSize()
Description copied from interface:IDvrEncryptionInfo
Return number of bytes required to serialize this encryption info.- Specified by:
getSerializeSize
in interfaceIDvrEncryptionInfo
- Returns:
- number of bytes to serialize.
-
serialize
public byte[] serialize()
Description copied from interface:IDvrEncryptionInfo
Serialize the encryption info, returning a byte buffer containing the serialized data.- Specified by:
serialize
in interfaceIDvrEncryptionInfo
- Returns:
- byte buffer of serialized data
-
serialize
public int serialize(byte[] buffer, int pos)
Description copied from interface:IDvrEncryptionInfo
Serialize the encryption info into buffer starting at position 'pos'.- Specified by:
serialize
in interfaceIDvrEncryptionInfo
- Parameters:
buffer
- buffer to serialize topos
- position to start serializing- Returns:
- new position into buffer
-
deserialize
public static CencInfo deserialize(byte[] data)
-
deserialize
public static CencInfo deserialize(java.nio.ByteBuffer buffer)
-
toString
public String toString()
- Overrides:
toString
in classObject
-
getPSSHVersion
public int getPSSHVersion()
-
setPSSHVersion
public void setPSSHVersion(int psshVersion)
-
getPSSHFlags
public int getPSSHFlags()
-
setPSSHFlags
public void setPSSHFlags(int psshFlags)
-
getEncryptionType
public int getEncryptionType()
Description copied from interface:IDvrEncryptionInfo
Serialize encryption info.The encryption should consist of the following:
- version (1 byte)
- encryption type (1 byte)
- length of 'blob' (2 bytes)
- byte blob (n bytes)
- Specified by:
getEncryptionType
in interfaceIDvrEncryptionInfo
- Returns:
- encryption type (constants defined in this class)
-
clone
public Object clone() throws CloneNotSupportedException
- Specified by:
clone
in interfaceIDvrEncryptionInfo
- Overrides:
clone
in classObject
- Throws:
CloneNotSupportedException
-
-