|
1 /* |
|
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * Name : CSIPSecDigest.h |
|
16 * Part of : SIPSec/DigestPlugin |
|
17 * Version : SIP/6.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef __CSIPSEC_DIGEST_H__ |
|
29 #define __CSIPSEC_DIGEST_H__ |
|
30 |
|
31 // INCLUDES |
|
32 #include "SipStackServerDefs.h" |
|
33 #include <e32base.h> |
|
34 #include <stringpool.h> |
|
35 |
|
36 // CONSTANTS |
|
37 _LIT8( KSIPSecDigestName, "digest"); |
|
38 _LIT8( KSIPSecDigestScheme, "Digest"); |
|
39 _LIT8( KSIPSecAuthInt, "auth-int"); |
|
40 _LIT8( KSIPSecAuth, "auth"); |
|
41 |
|
42 const TInt KSIPSecDigestHashHexSize( 32 ); |
|
43 |
|
44 // FORWARD DECLARATIONS |
|
45 class RStringF; |
|
46 class TSIPSecPluginCtxResponse; |
|
47 class CMD5; |
|
48 class CSIPSecurityClientHeader; |
|
49 class CSIPSecurityServerHeader; |
|
50 |
|
51 // CLASS DECLARATION |
|
52 /** |
|
53 * @brief Class represents digest mechanism. |
|
54 * |
|
55 * @class CSIPSecDigest CSIPSecDigest.h "CSIPSecDigest.h" |
|
56 * |
|
57 * This class provides functions to handle security negotiation |
|
58 * and cache update when response has been received |
|
59 */ |
|
60 class CSIPSecDigest : public CBase |
|
61 { |
|
62 public: // Enumerations |
|
63 |
|
64 enum TChallengeType |
|
65 { |
|
66 EOutboundProxy = 0, |
|
67 EProxy = 1, |
|
68 EEndPoint = 2 |
|
69 }; |
|
70 |
|
71 public: // Constructors and destructor |
|
72 |
|
73 /** |
|
74 * Constructs the object. |
|
75 * @return New CSIPSecDigest object, ownership is tranferred. |
|
76 */ |
|
77 static CSIPSecDigest* NewL(); |
|
78 |
|
79 /** |
|
80 * Destructor |
|
81 */ |
|
82 ~CSIPSecDigest(); |
|
83 |
|
84 public: // New functions |
|
85 |
|
86 /** |
|
87 * Offers digest parameter in sec-agree negotiation |
|
88 * @param aSecurityClient Security client header |
|
89 */ |
|
90 void OfferL( CSIPSecurityClientHeader& aSecurityClient ); |
|
91 |
|
92 /** |
|
93 * Initialiazes mechanism when it has been selected |
|
94 * @param aSecurityServer Security server header |
|
95 */ |
|
96 void InitializeL( CSIPSecurityServerHeader& aSecurityServer ); |
|
97 |
|
98 /** |
|
99 * Gets the name of the mechanism |
|
100 * |
|
101 * @return Name of the mechanism |
|
102 */ |
|
103 const TDesC8& Name() const; |
|
104 |
|
105 /** |
|
106 * Updates cache based on an incoming SIP response. |
|
107 * @param aContext Response context |
|
108 * @return ETrue Asynchronous operation has been started, and must wait for |
|
109 * it to complete the action. |
|
110 */ |
|
111 TBool UpdateCacheL( TSIPSecPluginCtxResponse& aContext ); |
|
112 |
|
113 /** |
|
114 * Returns message digest functionality |
|
115 * @return Message digest |
|
116 */ |
|
117 CMD5& MessageDigest(); |
|
118 |
|
119 /** |
|
120 * Default algorithm |
|
121 * @return Name of the algorithm |
|
122 */ |
|
123 RStringF Algorithm() const; |
|
124 |
|
125 /** |
|
126 * Sets default algorithm |
|
127 * @param aAlgorithm name of algorithm |
|
128 */ |
|
129 void SetDefaultAlgorithm( RStringF aAlgorithm ); |
|
130 |
|
131 private: // New functions, for internal use |
|
132 |
|
133 /* |
|
134 * Constructor |
|
135 */ |
|
136 CSIPSecDigest(); |
|
137 |
|
138 /* |
|
139 * Second phase constructor |
|
140 */ |
|
141 void ConstructL(); |
|
142 |
|
143 private: // Data |
|
144 |
|
145 // Owned |
|
146 CMD5* iMessageDigest; |
|
147 |
|
148 RStringF iAlgorithm; |
|
149 |
|
150 TBool iStringPoolOpened; |
|
151 }; |
|
152 |
|
153 #endif //end of __CSIPSEC_DIGEST_H__ |
|
154 |
|
155 // End of File |