@SuppressWarnings("unchecked") @Override public Hashtable<Integer, byte[]> getServerExtensions() throws IOException { Hashtable<Integer, byte[]> serverExtensions = (Hashtable<Integer, byte[]>) super.getServerExtensions(); if (TlsSRTPUtils.getUseSRTPExtension(serverExtensions) == null) { if (serverExtensions == null) { serverExtensions = new Hashtable<Integer, byte[]>(); } TlsSRTPUtils.addUseSRTPExtension(serverExtensions, serverSrtpData ); } return serverExtensions; }
public static void addUseSRTPExtension(Hashtable extensions, UseSRTPData useSRTPData) throws IOException { extensions.put(EXT_use_srtp, createUseSRTPExtension(useSRTPData)); }
public static UseSRTPData getUseSRTPExtension(Hashtable extensions) throws IOException { byte[] extensionData = TlsUtils.getExtensionData(extensions, EXT_use_srtp); return extensionData == null ? null : readUseSRTPExtension(extensionData); }
@SuppressWarnings("rawtypes") @Override public void processClientExtensions(Hashtable newClientExtensions) throws IOException { super.processClientExtensions(newClientExtensions); // set to some reasonable default value int chosenProfile = SRTPProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_80; UseSRTPData clientSrtpData = TlsSRTPUtils.getUseSRTPExtension(newClientExtensions); for (int profile : clientSrtpData.getProtectionProfiles()) { switch (profile) { case SRTPProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_32: case SRTPProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_80: case SRTPProtectionProfile.SRTP_NULL_HMAC_SHA1_32: case SRTPProtectionProfile.SRTP_NULL_HMAC_SHA1_80: chosenProfile = profile; break; default: } } // server chooses a mutually supported SRTP protection profile // http://tools.ietf.org/html/draft-ietf-avt-dtls-srtp-07#section-4.1.2 int[] protectionProfiles = { chosenProfile }; // server agrees to use the MKI offered by the client serverSrtpData = new UseSRTPData(protectionProfiles, clientSrtpData.getMki()); }
@SuppressWarnings("rawtypes") @Override public void processClientExtensions(Hashtable newClientExtensions) throws IOException { super.processClientExtensions(newClientExtensions); // set to some reasonable default value int chosenProfile = SRTPProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_80; UseSRTPData clientSrtpData = TlsSRTPUtils.getUseSRTPExtension(newClientExtensions); for (int profile : clientSrtpData.getProtectionProfiles()) { switch (profile) { case SRTPProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_32: case SRTPProtectionProfile.SRTP_AES128_CM_HMAC_SHA1_80: case SRTPProtectionProfile.SRTP_NULL_HMAC_SHA1_32: case SRTPProtectionProfile.SRTP_NULL_HMAC_SHA1_80: chosenProfile = profile; break; default: } } // server chooses a mutually supported SRTP protection profile // http://tools.ietf.org/html/draft-ietf-avt-dtls-srtp-07#section-4.1.2 int[] protectionProfiles = { chosenProfile }; // server agrees to use the MKI offered by the client serverSrtpData = new UseSRTPData(protectionProfiles, clientSrtpData.getMki()); }
@SuppressWarnings("unchecked") @Override public Hashtable<Integer, byte[]> getServerExtensions() throws IOException { Hashtable<Integer, byte[]> serverExtensions = (Hashtable<Integer, byte[]>) super.getServerExtensions(); if (TlsSRTPUtils.getUseSRTPExtension(serverExtensions) == null) { if (serverExtensions == null) { serverExtensions = new Hashtable<Integer, byte[]>(); } TlsSRTPUtils.addUseSRTPExtension(serverExtensions, serverSrtpData ); } return serverExtensions; }
public static UseSRTPData getUseSRTPExtension(Hashtable extensions) throws IOException { byte[] extensionData = TlsUtils.getExtensionData(extensions, EXT_use_srtp); return extensionData == null ? null : readUseSRTPExtension(extensionData); }
public static void addUseSRTPExtension(Hashtable extensions, UseSRTPData useSRTPData) throws IOException { extensions.put(EXT_use_srtp, createUseSRTPExtension(useSRTPData)); }
= TlsSRTPUtils.getUseSRTPExtension(clientExtensions);
/** * {@inheritDoc} * * Includes the <tt>use_srtp</tt> extension in the DTLS extended client * hello. */ @Override @SuppressWarnings("rawtypes") public Hashtable getClientExtensions() throws IOException { Hashtable clientExtensions = super.getClientExtensions(); if (!isSrtpDisabled() && TlsSRTPUtils.getUseSRTPExtension(clientExtensions) == null) { if (clientExtensions == null) clientExtensions = new Hashtable(); TlsSRTPUtils.addUseSRTPExtension( clientExtensions, new UseSRTPData( DtlsControlImpl.SRTP_PROTECTION_PROFILES, mki)); } return clientExtensions; }
= TlsSRTPUtils.getUseSRTPExtension(serverExtensions);
if (TlsSRTPUtils.getUseSRTPExtension(serverExtensions) == null) = TlsSRTPUtils.getUseSRTPExtension(clientExtensions); int chosenProtectionProfile = DtlsControlImpl.chooseSRTPProtectionProfile( TlsSRTPUtils.addUseSRTPExtension( serverExtensions, new UseSRTPData(