Class 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
    • Constructor Detail

      • CencInfo

        public CencInfo()
    • 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 interface com.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 interface com.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 systemId

        Example hashKey: "myDRM:12345678-1234-1234-1234-123456789123"

        Parameters:
        hashKey - hash key
        drm - the drm info instance
      • getDRMs

        public java.util.Map<String,​ICencDRMInfo> getDRMs()
      • getEncRepeaterBytes

        public byte[] getEncRepeaterBytes()
      • setEncRepeaterBytes

        public void setEncRepeaterBytes​(byte[] encRepeaterBytes)
      • 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 interface IDvrEncryptionInfo
        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 interface IDvrEncryptionInfo
        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 interface IDvrEncryptionInfo
        Parameters:
        buffer - buffer to serialize to
        pos - 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 class Object
      • 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 interface IDvrEncryptionInfo
        Returns:
        encryption type (constants defined in this class)
      • clone

        public Object clone()
                     throws CloneNotSupportedException
        Specified by:
        clone in interface IDvrEncryptionInfo
        Overrides:
        clone in class Object
        Throws:
        CloneNotSupportedException