|
1 /* |
|
2 * Copyright (c) 2004 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef __UT_CSRTPCRYPTOHANDLERSRTP_H__ |
|
22 #define __UT_CSRTPCRYPTOHANDLERSRTP_H__ |
|
23 |
|
24 // EXTERNAL INCLUDES |
|
25 #include <digia/eunit/ceunittestsuiteclass.h> |
|
26 #include "srtpmastersalt.h" |
|
27 #include "srtpmasterkey.h" |
|
28 #include "srtpcryptocontext.h" |
|
29 #include <in_sock.h> |
|
30 #include "msrtprekeyingobserver.h" |
|
31 #include "srtpcryptohandlersrtp.h" |
|
32 |
|
33 |
|
34 // INTERNAL INCLUDES |
|
35 |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CSRTPCryptoHandlerSRTP; |
|
39 class CSRTPSession; |
|
40 class CSRTPStreamIn; |
|
41 class CSRTPStreamOut; |
|
42 |
|
43 |
|
44 // CLASS DEFINITION |
|
45 /** |
|
46 * |
|
47 * EUnitWizard generated test class. |
|
48 * |
|
49 */ |
|
50 class UT_CSRTPCryptoHandlerSRTP |
|
51 : public CEUnitTestSuiteClass, |
|
52 public MSRTPReKeyingObserver |
|
53 { |
|
54 |
|
55 class TPayloadDetails |
|
56 { |
|
57 public: |
|
58 TPayloadDetails(); |
|
59 |
|
60 public: |
|
61 TUint16 seqNr; |
|
62 // TUint8* ssrc; |
|
63 TUint8 padding; |
|
64 TUint8 numCSRC; |
|
65 TBool fHeaderExtension; |
|
66 TUint8 payloadLen; |
|
67 const TUint8* payloadData; |
|
68 TUint8 MKILen; |
|
69 const TUint8* MKIData; |
|
70 TUint8 authTagLen; |
|
71 const TUint8* authTagData; |
|
72 }; |
|
73 |
|
74 public: // Constructors and destructors |
|
75 |
|
76 /** |
|
77 * Two phase construction |
|
78 */ |
|
79 static UT_CSRTPCryptoHandlerSRTP* NewL(); |
|
80 static UT_CSRTPCryptoHandlerSRTP* NewLC(); |
|
81 /** |
|
82 * Destructor |
|
83 */ |
|
84 ~UT_CSRTPCryptoHandlerSRTP(); |
|
85 |
|
86 void SRTPMasterKeyStaleEvent(const CSRTPStream& aStream); |
|
87 void SRTPMasterKeyStaleEvent(const CSRTPSession& aSession); |
|
88 |
|
89 private: // Constructors and destructors |
|
90 |
|
91 UT_CSRTPCryptoHandlerSRTP(); |
|
92 void ConstructL(); |
|
93 |
|
94 public: // From observer interface |
|
95 |
|
96 |
|
97 |
|
98 private: // New methods |
|
99 |
|
100 void SetupL(); |
|
101 |
|
102 void Teardown(); |
|
103 |
|
104 void UT_CSRTPCryptoHandlerSRTP_NewLL(); |
|
105 |
|
106 void UT_CSRTPCryptoHandlerSRTP_NewLCL(); |
|
107 |
|
108 |
|
109 HBufC8* BuildPacketL(TBool aSrtp, TPayloadDetails& details); |
|
110 |
|
111 |
|
112 void UT_DeriveSessionKeysL_1L(); |
|
113 |
|
114 |
|
115 void UT_UpdateROCL(); |
|
116 |
|
117 void Hex(HBufC8& aString); |
|
118 |
|
119 void CountSenderPacketIndexL( ); |
|
120 |
|
121 void ReplayProtectionL1L( ); |
|
122 void ReplayProtectionL2L( ); |
|
123 void ReplayProtectionL3L( ); |
|
124 void ReplayProtectionL4L( ); |
|
125 void TestPacketHeaderAndPayloadL( ); |
|
126 void TestAuthenticationL1L( ); |
|
127 void TestUpdate_s_l_and_RocLL(); |
|
128 void TestCountReceiverPacketIndexL(); |
|
129 void TestCheckMasterKeyIdentifierL(); |
|
130 void TestCountEncryptedPacketSizeL(); |
|
131 void TestCountEncryptedPacketSize2L(); |
|
132 void UT_InitializeEncryptedPacketLL(); |
|
133 |
|
134 private: // Data |
|
135 |
|
136 |
|
137 CSRTPMasterSalt* iMasterSalt; |
|
138 CSRTPMasterKey* iMasterKey; |
|
139 |
|
140 CSRTPCryptoContext* iContext; |
|
141 |
|
142 HBufC8* iTestPayload160Bits; |
|
143 HBufC8* iTestMKI128Bits; |
|
144 HBufC8* iTestAuthTag80Bits; |
|
145 |
|
146 CSRTPSession* iSRTPSession; |
|
147 CSRTPStreamIn* iStreamIn; |
|
148 CSRTPCryptoHandlerSRTP *iCryptoHandlerSRTP; |
|
149 TInetAddr iDestination; |
|
150 |
|
151 HBufC8* iRFC3711_SessionEncrKey128bits; |
|
152 HBufC8* iRFC3711_SessionSaltKey128bits; |
|
153 HBufC8* iRFC3711_SessionAuthKey128bits; |
|
154 HBufC8* iDecryptedPayload; |
|
155 TBool iReKeyCalled; |
|
156 EUNIT_DECLARE_TEST_TABLE; |
|
157 |
|
158 }; |
|
159 |
|
160 #endif // __UT_CSRTPCRYPTOHANDLERSRTP_H__ |
|
161 |
|
162 // End of file |