branch | RCL_3 |
changeset 34 | 696f5dd11939 |
parent 21 | 504e41245867 |
child 61 | b183ec05bd8c |
30:2de6635c154b | 34:696f5dd11939 |
---|---|
132 clearTextPtr = *userName; |
132 clearTextPtr = *userName; |
133 clearTextPtr += KColon; |
133 clearTextPtr += KColon; |
134 clearTextPtr += *password; |
134 clearTextPtr += *password; |
135 HBufC8* B64String = HBufC8::NewLC( clearText->Length() * 2 ); |
135 HBufC8* B64String = HBufC8::NewLC( clearText->Length() * 2 ); |
136 TPtr8 B64StringPtr( B64String->Des() ); |
136 TPtr8 B64StringPtr( B64String->Des() ); |
137 User::LeaveIfError( B64Coder.Encode( *clearText, B64StringPtr ) ); |
137 User::LeaveIfError( B64Coder.PortableEncode( *clearText, B64StringPtr ) ); |
138 CleanupStack::Pop(); // B64String |
138 CleanupStack::Pop(); // B64String |
139 CleanupStack::PopAndDestroy( 3 ); //clearText, password, userName |
139 CleanupStack::PopAndDestroy( 3 ); //clearText, password, userName |
140 return B64String; |
140 return B64String; |
141 } |
141 } |
142 |
142 |
189 userNamePasswordPtr += *password; |
189 userNamePasswordPtr += *password; |
190 TPtrC8 userNamePasswordHash; |
190 TPtrC8 userNamePasswordHash; |
191 userNamePasswordHash.Set( md5->Hash( *userNamePassword ) ); |
191 userNamePasswordHash.Set( md5->Hash( *userNamePassword ) ); |
192 HBufC8* B64UserNamePasswordString = HBufC8::NewLC( userNamePasswordHash.Length() * 2 ); |
192 HBufC8* B64UserNamePasswordString = HBufC8::NewLC( userNamePasswordHash.Length() * 2 ); |
193 TPtr8 B64UserNamePasswordStringPtr( B64UserNamePasswordString->Des() ); |
193 TPtr8 B64UserNamePasswordStringPtr( B64UserNamePasswordString->Des() ); |
194 User::LeaveIfError( B64Coder.Encode( userNamePasswordHash, B64UserNamePasswordStringPtr ) ); |
194 User::LeaveIfError( B64Coder.PortableEncode( userNamePasswordHash, B64UserNamePasswordStringPtr ) ); |
195 HBufC8* userNamePasswordNonce = HBufC8::NewLC( B64UserNamePasswordStringPtr.Length() + KColon.iTypeLength + nonce->Length() ); |
195 HBufC8* userNamePasswordNonce = HBufC8::NewLC( B64UserNamePasswordStringPtr.Length() + KColon.iTypeLength + nonce->Length() ); |
196 TPtr8 userNamePasswordNoncePtr = userNamePasswordNonce->Des(); |
196 TPtr8 userNamePasswordNoncePtr = userNamePasswordNonce->Des(); |
197 userNamePasswordNoncePtr = B64UserNamePasswordStringPtr; |
197 userNamePasswordNoncePtr = B64UserNamePasswordStringPtr; |
198 userNamePasswordNoncePtr += KColon; |
198 userNamePasswordNoncePtr += KColon; |
199 userNamePasswordNoncePtr += *nonce; |
199 userNamePasswordNoncePtr += *nonce; |
201 TPtrC8 finalHash; |
201 TPtrC8 finalHash; |
202 md5->Reset(); |
202 md5->Reset(); |
203 finalHash.Set( md5->Hash( *userNamePasswordNonce ) ); |
203 finalHash.Set( md5->Hash( *userNamePasswordNonce ) ); |
204 HBufC8* B64String = HBufC8::NewLC( finalHash.Length() * 2 ); |
204 HBufC8* B64String = HBufC8::NewLC( finalHash.Length() * 2 ); |
205 TPtr8 B64StringPtr( B64String->Des() ); |
205 TPtr8 B64StringPtr( B64String->Des() ); |
206 User::LeaveIfError( B64Coder.Encode( finalHash, B64StringPtr ) ); |
206 User::LeaveIfError( B64Coder.PortableEncode( finalHash, B64StringPtr ) ); |
207 CleanupStack::Pop(); // B64String |
207 CleanupStack::Pop(); // B64String |
208 CleanupStack::PopAndDestroy( 8 ); //userNamePasswordNonce, B64userNamePasswordNonce, userNamePassword, nonce, nonceInUnicode, password, userName, md5 |
208 CleanupStack::PopAndDestroy( 8 ); //userNamePasswordNonce, B64userNamePasswordNonce, userNamePassword, nonce, nonceInUnicode, password, userName, md5 |
209 return B64String; |
209 return B64String; |
210 } |
210 } |
211 |
211 |