public static SrtpPolicy CreateSrtpPolicy(byte[] dtlsKeyMaterial) { var derivedKeys = new DtlsSrtpDerivedKeys(dtlsKeyMaterial, SrtpConstants.SrtpDefaultMasterKeyKeyLength, SrtpConstants.SrtpDefaultMasterKeySaltLength); var srtpPolicy = new SrtpPolicy { MasterKey = derivedKeys.ServerKey, MasterSalt = derivedKeys.ServerSalt }; return(srtpPolicy); }
/** * Construct a SRTPTransformEngine based on given master encryption key, * master salt key and SRTP/SRTCP policy. * * @param masterKey * the master encryption key * @param masterSalt * the master salt key * @param srtpPolicy * SRTP policy * @param srtcpPolicy * SRTCP policy */ public SrtpTransformEngine(byte[] masterKey, byte[] masterSalt, SrtpPolicy srtpPolicy, SrtpPolicy srtcpPolicy) { defaultContext = new SrtpCryptoContext(0, 0, 0, masterKey, masterSalt, srtpPolicy); defaultContextControl = new SrtcpCryptoContext(0, masterKey, masterSalt, srtcpPolicy); }