public void prepareSrtpSharedSecret() {
    	SRTPParameters srtpParams = SRTPParameters.getSrtpParametersForProfile(serverSrtpData.getProtectionProfiles()[0]);
    	final int keyLen = srtpParams.getCipherKeyLength();
    	final int saltLen = srtpParams.getCipherSaltLength();
    	
    	srtpPolicy = srtpParams.getSrtpPolicy();
    	srtcpPolicy = srtpParams.getSrtcpPolicy();
    	
        srtpMasterClientKey = new byte[keyLen];
        srtpMasterServerKey = new byte[keyLen];
        srtpMasterClientSalt = new byte[saltLen];
        srtpMasterServerSalt = new byte[saltLen];
        
        // 2* (key + salt lenght) / 8. From http://tools.ietf.org/html/rfc5764#section-4-2
        // No need to divide by 8 here since lengths are already in bits
        byte[] sharedSecret = getKeyingMaterial(2 * (keyLen + saltLen));
        
        /*
         * 
         * See: http://tools.ietf.org/html/rfc5764#section-4.2
         * 
         * sharedSecret is an equivalent of :
         * 
         * struct {
         *     client_write_SRTP_master_key[SRTPSecurityParams.master_key_len];
         *     server_write_SRTP_master_key[SRTPSecurityParams.master_key_len];
         *     client_write_SRTP_master_salt[SRTPSecurityParams.master_salt_len];
         *     server_write_SRTP_master_salt[SRTPSecurityParams.master_salt_len];
         *  } ;
         *
         * Here, client = local configuration, server = remote.
         * NOTE [ivelin]: 'local' makes sense if this code is used from a DTLS SRTP client. 
         *                Here we run as a server, so 'local' referring to the client is actually confusing. 
         * 
         * l(k) = KEY length
         * s(k) = salt lenght
         * 
         * So we have the following repartition :
         *                           l(k)                                 2*l(k)+s(k)   
         *                                                   2*l(k)                       2*(l(k)+s(k))
         * +------------------------+------------------------+---------------+-------------------+
         * + local key           |    remote key    | local salt   | remote salt   |
         * +------------------------+------------------------+---------------+-------------------+
         */
        System.arraycopy(sharedSecret, 0, srtpMasterClientKey, 0, keyLen); 
        System.arraycopy(sharedSecret, keyLen, srtpMasterServerKey, 0, keyLen);
        System.arraycopy(sharedSecret, 2*keyLen, srtpMasterClientSalt, 0, saltLen);
        System.arraycopy(sharedSecret, (2*keyLen+saltLen), srtpMasterServerSalt, 0, saltLen);    	
    }
public void prepareSrtpSharedSecret ( ) { SRTPParameters srtpParams = SRTPParameters . getSrtpParametersForProfile ( serverSrtpData . getProtectionProfiles ( ) [ 0 ] ) ; final int keyLen = srtpParams . getCipherKeyLength ( ) ; final int saltLen = srtpParams . getCipherSaltLength ( ) ; srtpPolicy = srtpParams . getSrtpPolicy ( ) ; srtcpPolicy = srtpParams . getSrtcpPolicy ( ) ; srtpMasterClientKey = new byte [ keyLen ] ; srtpMasterServerKey = new byte [ keyLen ] ; srtpMasterClientSalt = new byte [ saltLen ] ; srtpMasterServerSalt = new byte [ saltLen ] ; byte [ ] sharedSecret = getKeyingMaterial ( 2 * ( keyLen + saltLen ) ) ; System . arraycopy ( sharedSecret , 0 , srtpMasterClientKey , 0 , keyLen ) ; System . arraycopy ( sharedSecret , keyLen , srtpMasterServerKey , 0 , keyLen ) ; System . arraycopy ( sharedSecret , 2 * keyLen , srtpMasterClientSalt , 0 , saltLen ) ; System . arraycopy ( sharedSecret , ( 2 * keyLen + saltLen ) , srtpMasterServerSalt , 0 , saltLen ) ; }
@return the shared secret key that will be used for the SRTP session