14 // |
14 // |
15 |
15 |
16 // User includes |
16 // User includes |
17 #include "csecuresocketcontroller.h" |
17 #include "csecuresocketcontroller.h" |
18 #include "thttptrlayerpanic.h" |
18 #include "thttptrlayerpanic.h" |
|
19 #include "chttptransportlayer.h" |
19 #include <x509certext.h> |
20 #include <x509certext.h> |
20 #include <securesocket.h> |
21 #include <securesocket.h> |
21 #include <ssl_internal.h> |
22 #include <ssl_internal.h> |
22 |
23 #include <featdiscovery.h> |
|
24 #include <featureuids.h> |
23 |
25 |
24 CSecureSocketController* CSecureSocketController::NewL(TAny* aInitParams) |
26 CSecureSocketController* CSecureSocketController::NewL(TAny* aInitParams) |
25 /** |
27 /** |
26 Factory constructor. |
28 Factory constructor. |
27 @param aSocket The socket that requires a secure connection, |
29 @param aSocket The socket that requires a secure connection, |
71 against certificates. |
73 against certificates. |
72 */ |
74 */ |
73 { |
75 { |
74 // Create the secure layer |
76 // Create the secure layer |
75 if( iTlsSocket == NULL ) |
77 if( iTlsSocket == NULL ) |
76 { |
78 iTlsSocket = CSecureSocket::NewL(iSocket, aProtocolVersion); |
77 iTlsSocket = CSecureSocket::NewL(iSocket, aProtocolVersion); |
79 MSecurityPolicy* securityPolicy = NULL; |
78 } |
80 |
|
81 TBool allowUntrustedCertificates = EFalse; |
|
82 |
|
83 allowUntrustedCertificates = CFeatureDiscovery::IsFeatureSupportedL(NFeature::KFeatureIdFfHttpAllowUntrustedCertificates); |
79 // Get the security preferences, dialog prompt and security policy |
84 // Get the security preferences, dialog prompt and security policy |
80 TBool dialogPref = ETrue; |
85 if( allowUntrustedCertificates ) |
81 MSecurityPolicy* securityPolicy = NULL; |
86 { |
82 iCommsInfoProvider.SecurityPreferences(dialogPref, securityPolicy); |
87 TInt dialogPref( CHttpTransportLayer::ETHttpDialogModeAttended ); |
83 |
88 iCommsInfoProvider.SecurityPreferences(dialogPref, securityPolicy); |
84 // Dialog preferences |
89 if ( CHttpTransportLayer::ETHttpDialogModeAllowAutomatic == dialogPref ) |
85 if( !dialogPref ) |
90 { |
86 User::LeaveIfError(iTlsSocket->SetDialogMode(EDialogModeUnattended)); |
91 User::LeaveIfError(iTlsSocket->SetDialogMode(EDialogModeAllowAutomatic)); |
|
92 } |
|
93 } |
|
94 else |
|
95 { |
|
96 TBool dialogPref = ETrue; |
|
97 iCommsInfoProvider.SecurityPreferences(dialogPref, securityPolicy); |
|
98 if( !dialogPref ) |
|
99 User::LeaveIfError(iTlsSocket->SetDialogMode(EDialogModeUnattended)); |
|
100 } |
87 |
101 |
88 // Security policy preferences |
102 // Security policy preferences |
89 if( securityPolicy ) |
103 if( securityPolicy ) |
90 { |
104 { |
91 TPtrC8 ciphers = securityPolicy->GetTlsCipherSuites(); |
105 TPtrC8 ciphers = securityPolicy->GetTlsCipherSuites(); |