当前位置: 首页>>代码示例>>C++>>正文


C++ TDes8::Length方法代码示例

本文整理汇总了C++中TDes8::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ TDes8::Length方法的具体用法?C++ TDes8::Length怎么用?C++ TDes8::Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TDes8的用法示例。


在下文中一共展示了TDes8::Length方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: password

inline void CPppMsChap2::HashNtPasswordHashL(
    const TDesC8& aPasswordHash,
    TDes8& aPasswordHashHash)
/**
   Computes the hash of the hash of the Microsoft Windows NT password
   using MD4.
   @param aPasswordHash [in] The hash of the Microsoft Windows NT
   password (16 octets).
   @param aPasswordHashHash [out] The hash of the hash of the
   Microsoft Windows NT password, computed using MD4 (16 octets).
   @note This function implements the HashNtPasswordHash routine
   specified in RFC 2759.
   @internalComponent
*/
{
    ASSERT(aPasswordHash.Length()==KPppMsChap2HashSize);
    ASSERT(aPasswordHashHash.Length()==KPppMsChap2HashSize);

    CMd4* md4 = CMd4::NewL();
    CleanupStack::PushL(md4);

// 	aPasswordHashHash.Copy(md4.Final(aPasswordHash));

    md4->Input(aPasswordHash);
    md4->Output(aPasswordHashHash);

    CleanupStack::PopAndDestroy(md4);

    ASSERT(aPasswordHashHash.Length()==KPppMsChap2HashSize);
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:30,代码来源:mschap2.cpp

示例2: NTChallengeResponseL

inline void CPppMsChap::NTChallengeResponseL(const TDesC8& aChallenge,
					     const TDesC16& aPassword,
					     TDes8& aResponse)
/**
   Computes a MS-CHAP Windows NT compatible Challenge Response.
   @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   @param aPassword [in] The Microsoft Windows NT password (0 to 256
   Unicode char).
   @param aResponse [out] The MS-CHAP Windows NT compatible Challenge
   Response (24 octets).
   @note This function implements the NTChallengeResponse routine
   specified in RFC 2433.
   @internalComponent
*/
	{
	ASSERT(aChallenge.Length() == KPppMsChapChallengeSize);
	ASSERT(aPassword.Length() <= KPppMsChapMaxNTPasswordLength);
	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);

	HBufC8* paddedPasswordHashBuf =
			HBufC8::NewLC(KPppMsChapPaddedHashSize);
	TPtr8 paddablePasswordHash(paddedPasswordHashBuf->Des());

	paddablePasswordHash.SetLength(KPppMsChapHashSize);
	NtPasswordHashL(aPassword, paddablePasswordHash);

	ChallengeResponseL(aChallenge, 
			paddablePasswordHash,
			aResponse);

	CleanupStack::PopAndDestroy(paddedPasswordHashBuf);
	ASSERT(aResponse.Length() == KPppMsChapNTResponseSize);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:33,代码来源:MSCHAP.CPP

示例3: ReadString

TUint TInputManager::ReadString(TDes8& aStr)
	{
	TKeyCode key;
	
	aStr.Zero();
	
	while( (key = iConsole.Getch()) != EKeyEnter)
		{
		if (aStr.Length() == aStr.MaxLength())
			return aStr.MaxLength();
		
		if (key == EKeyBackspace)
			{
			if (aStr.Length() > 0)
				{
				aStr.Delete(aStr.Length()-1, 1);
				ConsoleBackspace(1);
				}
			}
		else
			{
			TUint8 keyChar(key);
			aStr.Append(keyChar);
			iConsole.Printf(_L("%c"), keyChar);
			}
		}
	iConsole.Printf(_L("\n"));
	return aStr.Length();
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:29,代码来源:hcemulator.cpp

示例4: LmChallengeResponseL

// NB The use of the LAN Manager compatible challenge response has
// been deprecated according to RFC 2433.
inline void CPppMsChap::LmChallengeResponseL(const TDesC8& aChallenge,
					const TDesC8& aPassword, 
					TDes8& aResponse)
/**
   Computes a MS-CHAP LAN Manager compatible Challenge Response.
   @param aChallenge [in] A MS-CHAP Challenge (8 octets).
   @param aPassword [in] The LAN Manager password (0 to 14 OEM char).
   @param aResponse [out] The MS-CHAP LAN Manager compatible Challenge
   Response (24 octets).
   @note This function implements the LmChallengeResponse routine
   specified in RFC 2433.
   @note The use of the LAN Manager compatible Challenge Response has
   been deprecated according to RFC 2433.
   @internalComponent
*/
	{
	ASSERT(aChallenge.Length() == KPppMsChapChallengeSize);
	ASSERT(aPassword.Length() <=
		KPppMsChapMaxLANManagerPasswordLength);
	ASSERT(aResponse.Length() == KPppMsChapLanManResponseSize);

	HBufC8* paddedPasswordHashBuf =
			HBufC8::NewLC(KPppMsChapPaddedHashSize);
	TPtr8 paddablePasswordHash(paddedPasswordHashBuf->Des());

	paddablePasswordHash.SetLength(KPppMsChapHashSize);
	LmPasswordHashL(aPassword, paddablePasswordHash);

	ChallengeResponseL(aChallenge, 
			paddablePasswordHash,
			aResponse);

	CleanupStack::PopAndDestroy(paddedPasswordHashBuf);
	ASSERT(aResponse.Length() == KPppMsChapLanManResponseSize);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:37,代码来源:MSCHAP.CPP

示例5: ParseExtension

// -----------------------------------------------------------------------------
// CUpnpHttpChunkParser::ParseL
// Decoding the chunked-encoded buffer
// -----------------------------------------------------------------------------
//
TBool CUpnpHttpChunkParser::ParseExtension( TDes8& aBuffer, TInt& aPos )
    {	
    if ( IsEmpty( aBuffer, aPos ) )
        {	    
        return ETrue;	
        }

    //if '\r\n' exists
    TInt lineFeed = aBuffer.Right( aBuffer.Length() - aPos ).FindF( UpnpString::KLineFeed );
    if ( lineFeed != KErrNotFound )
        {
        aBuffer.Delete( aPos, lineFeed + UpnpString::KLineFeed().Length() );		
        if ( !iChunkSize )
            {
            iContext = ETrailer;
            return EFalse;		
            }
        else
            {
            iContext = EBody;
            return EFalse;
            }		
        }
    else
        {
        //one character left - possible linefeed
        if ( aPos + 1 < aBuffer.Length() )
            {            
            aBuffer.Delete( aPos, aBuffer.Length() - aPos - 1 );
            }
        return ETrue;
        }
    }
开发者ID:cdaffara,项目名称:symbiandump-mw4,代码行数:38,代码来源:upnphttpchunkparser.cpp

示例6: InterfaceToBearer

/**
Convert data from the API's form (as we're given it by RemCon) the
bearer-specific form.
*/
TInt CCoreSerialConverter::InterfaceToBearer(TUid aInterfaceUid,
		TUint aOperationId,
		const TDesC8& aData,
		TRemConMessageType aMsgType,
		TDes8& aBearerData) const
	{
	TInt ret = KErrCorrupt;

	if ( aData.Length() <= 10 )
		{
		if ( aMsgType == ERemConCommand )
			{
			aBearerData.Format(_L8("0x%08x 0x%02x %S %S"), aInterfaceUid, aOperationId, &KCmdText(), &aData);
			// Pad it up in case aData was less than 4 characters.
			while ( aBearerData.Length() < KRemConSerialBearerMessageLength )
				{
				aBearerData.Append(_L8(" "));
				}
			ret = KErrNone;
			}
		else if ( aMsgType == ERemConResponse )
			{
			aBearerData.Format(_L8("0x%08x 0x%02x %S %S"), aInterfaceUid, aOperationId, &KRspText(), &aData);
			// Pad it up in case aData was less than 4 characters.
			while ( aBearerData.Length() < KRemConSerialBearerMessageLength )
				{
				aBearerData.Append(_L8(" "));
				}
			ret = KErrNone;
			}
		}

	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:38,代码来源:coreserialconverter.cpp

示例7: RecvLine

TInt RecvLine(RTest &aTest, TDes8 &aBuf, RSocket &aSock)
	{
	TInt offset=0;
	TText ch=0;

	do
		{
		TPtr8 ptr(NULL, 0);
		TSockXfrLength len;
		TRequestStatus stat;

		ptr.Set((TUint8 *)aBuf.Ptr()+offset, aBuf.Length()-offset, aBuf.Length()-offset);
		aSock.RecvOneOrMore(ptr,0,stat,len);
		User::WaitForRequest(stat);
		aTest(stat==KErrNone);
		TInt length=len();
		TInt n=0;
		while (length--)
			{
			ch = *(ptr.Ptr()+n);
			if (ch=='\r' || ch=='\n')
				break;
			++offset;
			++n;
			}
		}
	while (ch!='\r' && ch!='\n' );

	aBuf.SetLength(offset);
	return offset;
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:31,代码来源:FINGER.CPP

示例8:

void CPaddingSSLv3::DoPadL(const TDesC8& aInput,TDes8& aOutput)
	{
	TInt paddingBytes=BlockSize()-(aInput.Length()%BlockSize());
	aOutput.Append(aInput);
	aOutput.SetLength(aOutput.Length()+paddingBytes);
	for (TInt i=1;i<=paddingBytes;i++)
		{
		aOutput[aOutput.Length()-i]=(TUint8)(paddingBytes-1);
		}
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:10,代码来源:padding.cpp

示例9: challengeHash

inline void CPppMsChap2::GenerateNTResponseL(
    const TDesC8& aAuthenticatorChallenge,
    const TDesC8& aPeerChallenge,
    const TDesC8& aUserName,
    const TDesC16& aPassword,
    TDes8& aResponse)
/**
   Generates a MS-CHAP-V2 NT-Response.
   @param aAuthenticatorChallenge [in] The MS-CHAP-V2 authenticator
   challenge (16 octets).
   @param aPeerChallenge [in] The MS-CHAP-V2 peer challenge (16
   octets).
   @param aUserName [in] The Microsoft Windows NT username (0 to 256
   char).
   @param aPassword [in] The Microsoft Windows NT password (0 to 256
   unicode char).
   @param aResponse [out] The MS-CHAP-V2 Challenge Response,
   NT-Response (24 octets).
   @note This function implements the GenerateNTResponse routine
   specified in RFC 2759.
   @internalComponent
*/
{
    ASSERT(aAuthenticatorChallenge.Length() ==
           KPppMsChap2AuthenticatorChallengeSize);
    ASSERT(aPeerChallenge.Length() ==
           KPppMsChap2PeerChallengeSize);
    ASSERT(aUserName.Length() <= KPppMsChapMaxNTUserNameLength);
    ASSERT(aPassword.Length() <= KPppMsChapMaxNTPasswordLength);
    ASSERT(aResponse.Length() == KPppMsChap2NTResponseSize);

    HBufC8* challengeHashBuf =
        HBufC8::NewMaxLC(KPppMsChap2ChallengeHashSize);
    TPtr8 challengeHash(challengeHashBuf->Des());
    ChallengeHashL(aPeerChallenge,
                   aAuthenticatorChallenge,
                   aUserName,
                   challengeHash);

    HBufC8* paddedPasswordHashBuf =
        HBufC8::NewLC(KPppMsChap2PaddedHashSize);
    TPtr8 paddablePasswordHash(paddedPasswordHashBuf->Des());

    paddablePasswordHash.SetLength(KPppMsChap2HashSize);
    NtPasswordHashL(aPassword, paddablePasswordHash);

    ChallengeResponseL(challengeHash,
                       paddablePasswordHash,
                       aResponse);

    CleanupStack::PopAndDestroy(paddedPasswordHashBuf);
    CleanupStack::PopAndDestroy(challengeHashBuf);

    ASSERT(aResponse.Length()==KPppMsChap2NTResponseSize);
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:55,代码来源:mschap2.cpp

示例10: TrimRightSpaceAndNull

// ---------------------------------------------------------
// CNSmlCmdsBase::TrimRightSpaceAndNull
// Trims right spaces and zero terminator (NULL) 
// ---------------------------------------------------------
EXPORT_C void CNSmlCmdsBase::TrimRightSpaceAndNull( TDes8& aDes ) const
	{
	aDes.TrimRight();
	if ( aDes.Length() > 0 )
		{
		if ( aDes[aDes.Length() - 1] == NULL )
			{
			aDes.SetLength( aDes.Length() - 1 );
			}	
		}
	}
开发者ID:kuailexs,项目名称:symbiandump-mw3,代码行数:15,代码来源:nsmlcmdsbase.cpp

示例11: GetData

void CIpcStreamProvd::GetData(TDes8 &aDesc,TUint /*options*/,TSockAddr* /*anAddr*/)
	{
	__ASSERT_DEBUG(iConnection,Panic(EBadWriteCall));
	__ASSERT_DEBUG(iSocket,Panic(EBadWriteCall));

	CCirBuffer& buf=((CIpcStreamProvd *)iConnection)->iBuffer;

	__ASSERT_DEBUG(aDesc.Length()<=buf.Count(),Panic(EReadGetTooMuch));

	buf.Remove((TUint8 *)aDesc.Ptr(),aDesc.Length());
	iConnection->CanSend();
	}
开发者ID:cdaffara,项目名称:symbiandump-os1,代码行数:12,代码来源:IPC_PRVD.CPP

示例12: ReplaceUrl

//////////////////////////////////////////////////////////////////////
// util
//////////////////////////////////////////////////////////////////////
void ReplaceUrl(TDes8& aUrl,const TDesC8& aIsRepeatedKStr,const TDesC8& aStr){
  HBufC8* tmp=HBufC8::NewL(aUrl.Length()+aStr.Length()+128);
  int iPos=aUrl.FindF(aIsRepeatedKStr);
  if(iPos>=0){
    tmp->Des().Copy(aUrl.Left(iPos)); //加上前面有用的字符
    tmp->Des().Append(aStr);
    int iStart=iPos+aIsRepeatedKStr.Length(); //要被替换的字符,加上要被替换的字符长度
    int iLen2=aUrl.Length()-iStart;
    tmp->Des().Append(aUrl.Mid(iStart,iLen2)); //加上后面有用的字符
    aUrl.Copy(tmp->Des());
  }
  delete tmp;
}
开发者ID:rusteer,项目名称:symbian,代码行数:16,代码来源:SocketEngine.cpp

示例13: userName

void CPppMsChap2::ChallengeHashL(const TDesC8& aPeerChallenge,
                                 const TDesC8& aAuthenticatorChallenge,
                                 const TDesC8& aUserName,
                                 TDes8& aChallengeHash)
/**
   Computes the hash of the Peer Challenge, Authenticator Challenge
   and username using SHA-1.
   @param aPeerChallenge [in] The Peer Challenge (16 octets).
   @param aAuthenticatorChallenge [in] The Authenticator Challenge (16
   octets).
   @param aUserName [in] The Microsoft Windows NT username (0 to 256
   char).
   @param aChallengeHash [out] The hash of the peer challenge,
   authenticator challenge and username, computed using SHA-1 (8
   octets).
   @note This function implements the ChallengeHash routine specified
   in RFC 2759.
   @internalComponent
*/
{
    ASSERT(aPeerChallenge.Length() ==
           KPppMsChap2PeerChallengeSize);
    ASSERT(aAuthenticatorChallenge.Length() ==
           KPppMsChap2AuthenticatorChallengeSize);
    ASSERT(aUserName.Length() <= KPppMsChapMaxNTUserNameLength);
    ASSERT(aChallengeHash.Length()==KPppMsChap2ChallengeHashSize);

    CSHA1* sha1 = CSHA1::NewL();
    CleanupStack::PushL(sha1);

// RFC 2759: "Only the user name (as presented by the peer and
// excluding any prepended domain name)"
    TPtrC8 userName(aUserName);
    TInt i = aUserName.Locate('\\');
    if (i >= 0 && i < userName.Length() - 1)
        userName.Set(aUserName.Mid(i + 1));
    else if (i >= userName.Length() - 1)
        User::Leave(KErrGeneral);


    sha1->Update(aPeerChallenge);
    sha1->Update(aAuthenticatorChallenge);

    aChallengeHash.Copy(sha1->Final(userName).Ptr(),
                        KPppMsChap2ChallengeHashSize);


    CleanupStack::PopAndDestroy(sha1);

    ASSERT(aChallengeHash.Length()==KPppMsChap2ChallengeHashSize);
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:51,代码来源:mschap2.cpp

示例14: RemoveSlashes

// -----------------------------------------------------------------------------
// UpnpAVCPEngine::RemoveSlashes
// -----------------------------------------------------------------------------
//   
void RemoveSlashes(TDes8& aPath) 
	{
	if (aPath.Length() > 0 && aPath[0] == '/' ) 
		{        
		aPath.Delete(0,1);
		}

	// remove ending '/' 
	TInt length = aPath.Length();                
	if (length > 0 && aPath[length-1] == '/' ) 
		{
		aPath.Delete(length-1,1);   
		}	   
	}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:18,代码来源:upnpavcpenginehelper.cpp

示例15: DesEncryptL

void CPppMsChap::DesEncryptL(const TDesC8& aClear, 
			const TDesC8& aKey,
			TDes8& aCypher)
/**
   Encrypts a plaintext into a ciphertext using the DES encryption
   algorithm in ECB mode.
   @param aClear [in] A plaintext (8 octets).
   @param aKey [in] A key (7 octets).
   @param aCypher [out] The ciphertext (8 octets).
   @note This function implements the DesEncrypt routine specified in
   RFC 2433.
   @internalComponent
*/
	{
	ASSERT(aClear.Length() == KPppMsChapDESClearTextSize);
	ASSERT(aKey.Length() == KPppMsChapDESKeySize);
	ASSERT(aCypher.Length() == KPppMsChapDESCipherTextSize);

	HBufC8* desKeyBuf=HBufC8::NewMaxLC(KPppDESKeySize);
	TPtr8 desKey(desKeyBuf->Des());

// RFC 2433: "Use the DES encryption algorithm [4] in ECB mode [10] to
// encrypt Clear into Cypher such that Cypher can only be decrypted
// back to Clear by providing Key.  Note that the DES algorithm takes
// as input a 64-bit stream where the 8th, 16th, 24th, etc.  bits are
// parity bits ignored by the encrypting algorithm.  Unless you write
// your own DES to accept 56-bit input without parity, you will need
// to insert the parity bits yourself."

	MakeDesKey(aKey, desKey);


 	CBlockTransformation* encryptor = 
		CDESEncryptor::NewLC(desKey, EFalse);
	CPaddingNone* padding = CPaddingNone::NewLC();
 	CBufferedEncryptor* bufEncryptor =
 		CBufferedEncryptor::NewL(encryptor, padding);
	CleanupStack::Pop(padding);
	CleanupStack::Pop(encryptor);
	CleanupStack::PushL(bufEncryptor);

	aCypher.Zero();
	bufEncryptor->ProcessFinalL(aClear, aCypher);

 	CleanupStack::PopAndDestroy(bufEncryptor);


	CleanupStack::PopAndDestroy(desKeyBuf);
	ASSERT(aCypher.Length() == KPppMsChapDESCipherTextSize);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:50,代码来源:MSCHAP.CPP


注:本文中的TDes8::Length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。