@ -5,6 +5,9 @@
* /
package net.java.sip.communicator.service.protocol ;
import net.java.sip.communicator.util.* ;
import org.jitsi.service.neomedia.* ;
import java.io.* ;
import java.util.* ;
@ -66,6 +69,9 @@ public SecurityAccountRegistration()
this . encryptionProtocols . put ( "ZRTP" , 0 ) ;
this . encryptionProtocolStatus = new HashMap < String , Boolean > ( 1 ) ;
this . encryptionProtocolStatus . put ( "ZRTP" , true ) ;
sdesCipherSuites
= UtilActivator . getResources ( )
. getSettingsString ( SDesControl . SDES_CIPHER_SUITES ) ;
}
/ * *
@ -297,14 +303,39 @@ public void loadAccount(AccountID accountID)
ProtocolProviderFactory . DEFAULT_ENCRYPTION ,
true ) ) ;
encryptionProtocols
encryptionProtocols = new HashMap < String , Integer > ( ) ;
encryptionProtocolStatus = new HashMap < String , Boolean > ( ) ;
Map < String , Integer > srcEncryptionProtocols
= accountID . getIntegerPropertiesByPrefix (
ProtocolProviderFactory . ENCRYPTION_PROTOCOL , true ) ;
encryptionProtocolStatus
Map< String , Bool ean> srcE ncryptionProtocolStatus
= accountID . getBooleanPropertiesByPrefix (
ProtocolProviderFactory . ENCRYPTION_PROTOCOL_STATUS ,
true ,
false ) ;
// Load stored values.
int prefixeLength
= ProtocolProviderFactory . ENCRYPTION_PROTOCOL . length ( ) + 1 ;
String name ;
boolean enabled ;
for ( String protocolPropertyName : srcEncryptionProtocols . keySet ( ) )
{
name = protocolPropertyName . substring ( prefixeLength ) ;
if ( isExistingEncryptionProtocol ( name ) )
{
// Copies the priority
encryptionProtocols . put (
name ,
srcEncryptionProtocols . get ( protocolPropertyName ) ) ;
// Extracts the status
enabled = srcEncryptionProtocolStatus . get (
ProtocolProviderFactory . ENCRYPTION_PROTOCOL_STATUS
+ "."
+ name ) ;
encryptionProtocolStatus . put ( name , enabled ) ;
}
}
setSipZrtpAttribute (
accountID . getAccountPropertyBoolean (
@ -343,30 +374,22 @@ public static Object[] loadEncryptionProtocols(
boolean [ ] selectedEncryptions = new boolean [ nbEncryptionProtocols ] ;
// Load stored values.
int prefixeLength
= ProtocolProviderFactory . ENCRYPTION_PROTOCOL . length ( ) + 1 ;
String encryptionProtocolPropertyName ;
String name ;
int index ;
boolean enabled ;
Iterator < String > encryptionProtocolNames
= encryptionProtocols . keySet ( ) . iterator ( ) ;
while ( encryptionProtocolNames . hasNext ( ) )
{
e ncryptionProtocolPropertyN ame = encryptionProtocolNames . next ( ) ;
index = encryptionProtocols . get ( e ncryptionProtocolPropertyN ame) ;
name = encryptionProtocolNames . next ( ) ;
index = encryptionProtocols . get ( name) ;
// If the property is set.
if ( index ! = - 1 )
{
name = encryptionProtocolPropertyName . substring ( prefixeLength ) ;
if ( isExistingEncryptionProtocol ( name ) )
{
enabled = encryptionProtocolStatus . get (
ProtocolProviderFactory . ENCRYPTION_PROTOCOL_STATUS
+ "."
+ name ) ;
encryptions [ index ] = name ;
selectedEncryptions [ index ] = enabled ;
selectedEncryptions [ index ]
= encryptionProtocolStatus . get ( name ) ;
}
}
}
@ -379,10 +402,7 @@ public static Object[] loadEncryptionProtocols(
{
encryptionProtocol = ENCRYPTION_PROTOCOLS [ i ] ;
// Specify a default value only if there is no specific value set.
if ( ! encryptionProtocols . containsKey (
ProtocolProviderFactory . ENCRYPTION_PROTOCOL
+ "."
+ encryptionProtocol ) )
if ( ! encryptionProtocols . containsKey ( encryptionProtocol ) )
{
set = false ;
// Search for the first empty element.