本文整理汇总了C++中CArrayPtrFlat::At方法的典型用法代码示例。如果您正苦于以下问题:C++ CArrayPtrFlat::At方法的具体用法?C++ CArrayPtrFlat::At怎么用?C++ CArrayPtrFlat::At使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArrayPtrFlat
的用法示例。
在下文中一共展示了CArrayPtrFlat::At方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: new
EXPORT_C void CX509Certificate::InternalizeL(RReadStream& aStream)
{
if (iIssuerName != NULL) //just to check cert is uninitialised
{
User::Leave(KErrArgument);
}
iKeyFactory = new(ELeave) TX509KeyFactory;
TInt len = aStream.ReadInt32L(); //Read the length of the streamed encoding
HBufC8* temp= HBufC8::NewLC(len);
TPtr8 ptr=temp->Des();
aStream.ReadL(ptr,len);
iEncoding=temp->AllocL();
CleanupStack::PopAndDestroy(); // temp
TASN1DecSequence encSeq;
TInt pos = 0;
CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(*iEncoding, pos, 3, 3);
TASN1DecGeneric* encSigAlg = seq->At(1);
iSigningAlgorithm = CX509SigningAlgorithmIdentifier::NewL(encSigAlg->Encoding());
TASN1DecBitString encBS;
iSignature = encBS.ExtractOctetStringL(*(seq->At(2)));
CleanupStack::PopAndDestroy();//seq
CSHA1* hash = CSHA1::NewL();
CleanupStack::PushL(hash);
iFingerprint = hash->Final(Encoding()).AllocL();
CleanupStack::PopAndDestroy();//hash
ConstructCertL();
}
示例2:
void CX509CertExtension::ConstructL(const TDesC8& aBinaryData, TInt& aPos)
{
TASN1DecSequence encSeq;
CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(aBinaryData, aPos, 2, KMaxTInt);
TASN1DecObjectIdentifier encOID;
iId = encOID.DecodeDERL(*(seq->At(0)));
//second is either critical flag, or the ext
TASN1DecGeneric* second = seq->At(1);
if (second->Tag() != EASN1Boolean)
{
iData = second->Encoding().AllocL();
aPos += second->LengthDER();
}
else
{
TASN1DecBoolean encBool;
iCritical = encBool.DecodeDERL(*second);
if (seq->Count() != 3)
{
User::Leave(KErrArgument);
}
TASN1DecGeneric* third = seq->At(2);
iData = third->Encoding().AllocL();
}
CleanupStack::PopAndDestroy();//seq
}
示例3:
void CWapDgrmTestStep::_Parse2L(CArrayPtrFlat<CSmsMessage>& aSmsArray,
CWapReassemblyStore* aWapStore)
/**
* This method tests mainly CWapDatagram::DecodeConcatenatedMessagesL
*/
{
TInt Count = aSmsArray.Count();
// In reverse order
// Note ! You can test additional features by changing value of
// i or a global variable (insertSms). For example:
// incrementing i by 1: a duplicate test
// decrementing i by 1: not all datagrams are pushed to the store
// ncreasing insertSms causes datagrams to be appended to the reserve array
// Remember to set flush the reserve array on a later phase
// by setting iIsFlushReserveArray true
for (TInt i=Count-1;i>=iInsertSms;i--)
{
CWapDatagram* Wap=CWapDatagram::NewL(*(aSmsArray.At(i)));
if (!Wap->IsComplete())
{
TInt Index = 0;
TBool IsComplete = EFalse;
IsComplete = aWapStore->AddMessageL(Index,*Wap);
if (IsComplete)
{
aWapStore->GetDatagramL(Index,*Wap);
aWapStore->BeginTransactionLC();
aWapStore->DeleteEntryL(Index);
aWapStore->CommitTransactionL();
_Print(*Wap);
}
}
else
_Print(*Wap);
delete Wap;
}
// append rest of the datagrams to the ReserveArray
if (iInsertSms>0 && Count>1)
{
// reserve order here too
for (TInt i=iInsertSms-1;i>=0;i--)
{
CWapDatagram* Wap=CWapDatagram::NewL(*(aSmsArray.At(i)));
iReserveArray->AppendL(Wap);
}
}
if (iIsFlushReserveArray)
{
_FlushReserveArrayL(aWapStore);
iInsertSms = 0;
iIsFlushReserveArray = EFalse;
}
}
示例4: seqGen
void CDecPkcs12Attribute::ConstructL(const TDesC8& aBagAttributes)
{
TASN1DecGeneric seqGen(aBagAttributes);
seqGen.InitL();
// Check if this is a Sequence
if (seqGen.Tag() != EASN1Sequence || seqGen.Class() != EUniversal)
{
User::Leave(KErrArgument);
}
TASN1DecSequence seq;
CArrayPtrFlat<TASN1DecGeneric>* attributeSet = seq.DecodeDERLC(seqGen);
const TASN1DecGeneric* attributeSetAt0 = attributeSet->At(0);
if(attributeSetAt0->Tag() != EASN1ObjectIdentifier || attributeSetAt0->Class() != EUniversal)
{
User::Leave(KErrArgument);
}
// Decode the ObjectIdentifier
TASN1DecObjectIdentifier oid;
iAttributeId = oid.DecodeDERL(*attributeSetAt0);
const TASN1DecGeneric* attributeSetAt1 = attributeSet->At(1);
if(attributeSetAt1->Tag() != EASN1Set || attributeSetAt1->Class() != EUniversal)
{
User::Leave(KErrArgument);
}
// Attribute Set
TASN1DecSet decSet;
CArrayPtrFlat<TASN1DecGeneric>* attributeValues = decSet.NewDERLC(attributeSetAt1->Encoding());
TInt attributeCount = attributeValues->Count();
for(TInt index = 0; index < attributeCount; ++index)
{
const TASN1DecGeneric* attributeValuesAt = attributeValues->At(index);
TASN1DecGeneric seqGen(*attributeValuesAt);
seqGen.InitL();
TPtrC8 attrValue = seqGen.Encoding();
TDesC8* attributeVal = attrValue.AllocL();
CleanupStack::PushL(attributeVal);
iAttributeValue.AppendL(attributeVal);
CleanupStack::Pop(attributeVal);
}
CleanupStack::PopAndDestroy(2,attributeSet); // attributeSet,attributeValues
}
示例5: ClearL
void CClearConfig::ClearL(RULogger& loggerSession)
{
loggerSession.Stop();//C.A. previously:loggerSession.StopOutputting();
loggerSession.DeActivateInputPlugin();
CArrayPtrFlat<HBufC8> *allplugins = new (ELeave)CArrayPtrFlat<HBufC8>(1);
loggerSession.GetInstalledOutputPlugins(*allplugins);//C.A. previously:loggerSession.InstalledOutputPlugins(*allplugins);
for(TInt i=0;i<(allplugins->Count());i++)
if(allplugins->Count())
{
TBuf8<50> dataBuf;
dataBuf.Copy(allplugins->At(i)->Des());
loggerSession.RemovePluginConfigurations(dataBuf);
}
CArrayFixFlat<TUint8> *getfilter = new (ELeave)CArrayFixFlat<TUint8>(1);
loggerSession.GetPrimaryFiltersEnabled(*getfilter);//C.A. previously:loggerSession.GetEnabledClassifications(*getfilter);
TInt Result=loggerSession.SetPrimaryFiltersEnabled(*getfilter,EFalse);//C.A. previously:TInt Result=loggerSession.DisableClassifications(*getfilter);
RArray<TUint32> get2filter;
loggerSession.GetSecondaryFiltersEnabled(get2filter);//C.A. previously:loggerSession.GetEnabledModuleUids(get2filter);
loggerSession.SetSecondaryFiltersEnabled(get2filter,EFalse);//C.A. previously:loggerSession.DisableModuleUids(get2filter);
//C.A. previously:loggerSession.EnableClassificationFiltering();
loggerSession.SetSecondaryFilteringEnabled(ETrue);//C.A. previously:loggerSession.EnableModuleUidFiltering();
loggerSession.SetBufferSize(1024);
loggerSession.SetNotificationSize(512);
loggerSession.SetBufferMode(1);//C.A. previously:loggerSession.SetBufferMode(EStraight);
}
示例6: gen
void CX509Certificate::ConstructL(const TDesC8& aBinaryData, TInt& aPos)
{
TASN1DecGeneric gen(aBinaryData.Right(aBinaryData.Length() - aPos));
gen.InitL();
// The outermost tag for X509 certificates is always a sequence.
// Since this tag does not form part of the signed data it is possible
// to corrupt the tag by changing it to any other ASN.1 tag and process
// the rest of the certificate as normal.
// However, we still reject the certificate anyway to avoid
// confusion because the data does not match the X.509 specification.
if (gen.Tag() != EASN1Sequence)
{
User::Leave(KErrArgument);
}
aPos += gen.LengthDER();
iKeyFactory = new(ELeave) TX509KeyFactory;
iEncoding = gen.Encoding().AllocL();
TASN1DecSequence encSeq;
TInt pos = 0;
CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(*iEncoding, pos, 3, 3);
TASN1DecGeneric* encSigAlg = seq->At(1);
iSigningAlgorithm = CX509SigningAlgorithmIdentifier::NewL(encSigAlg->Encoding());
TASN1DecBitString encBS;
iSignature = encBS.ExtractOctetStringL(*(seq->At(2)));
CleanupStack::PopAndDestroy();//seq
CSHA1* hash = CSHA1::NewL();
CleanupStack::PushL(hash);
iFingerprint = hash->Final(Encoding()).AllocL();
CleanupStack::PopAndDestroy();//hash
ConstructCertL();
}
示例7: SetFrameArrayL
/**
Sets the animation frames to the player.
*/
void RBitmapAnim::SetFrameArrayL(const CArrayPtrFlat<CBitmapFrameData>& aFrameArray)
{
const TInt count = aFrameArray.Count();
if (count > 0)
{
User::LeaveIfError(CommandReply(EBitmapAnimCommandResetFrameArray));
CBitmapFrameData* frameData;
User::LeaveIfError(CommandReply(EBitmapAnimCommandClearDataFrames));
TInt index = 0;
for (index = 0; index < count; index++)
{
frameData = aFrameArray.At(index);
SetFrameL(*frameData, EBitmapAnimCommandSetDataFrame);
}
}
}
示例8: VerifySignatureL
TBool IkePkiUtils::VerifySignatureL(TInt aIkeVersion,
const TDesC8& aSignature,
const TDesC8& aRefHash,
const CX509Certificate& aCert)
{
//
// Verify IKE signature.
//
TBool status = EFalse;
if ( aSignature.Length() > 0 )
{
CIkePublicKey* publicKey = CIkePublicKey::NewL(aCert);
if ( !publicKey )
{
return EFalse;
}
CleanupStack::PushL(publicKey);
switch (publicKey->Algorithm())
{
case EPKIRSA:
{
HBufC8 *resBuf;
TUtlCrypto::RsaPublicKeyDecryptL(publicKey->KeyData(), aSignature, resBuf);
CleanupStack::PushL(resBuf);
if ( aIkeVersion == MAJORV1 )
{
//
// Because IKEv1 signature is not a "real" PKCS1
// encoded signature but pure private encrypted has
// signature is verified by using RSA public key
// decrypt and result comparison to reference hash
//
status = (aRefHash.Compare(*resBuf) == 0); //Compare the result with the hash to see if they match
}
else
{
//
// IKEv2(n) signature is encoded as PKCS1v1_5
// signature (EMSA-PKCS1-v1_5)
// ASN1 encoding of signature is the following:
// DigestInfo::=SEQUENCE{
// digestAlgorithm AlgorithmIdentifier,
// digest OCTET STRING }
//
CArrayPtrFlat<TASN1DecGeneric>* seq = NULL;
TInt position = 0;
TRAPD(err, seq = DecodeDERL(*resBuf, position));
if ( err == KErrNone )
{
TCleanupItem CleanupSeq(IkeCert::CleanupSequence, seq);
CleanupStack::PushL(CleanupSeq);
if (seq->Count() == 2)
{
//
// Currently the digestAlgorithm is not
// verified, but only digest value itself is
// compared with reference hash.
// ( see CPKCS1SignatureResult::DoVerifyL() in
// x509cert.cpp)
//
const TASN1DecGeneric* gen2 = seq->At(1);
TPtrC8 digest(gen2->GetContentDER());
status = (aRefHash.Compare(digest) == 0);
}
CleanupStack::PopAndDestroy(); //CleanupSeq
}
else
{
//
// Verify signature as pure encrypted (SHA1)
// hash as old IKEv1 style "signature"
//
//DEB(iService.PrintText(_L("Old IKEv1 style signature used by IKEv2 peer !\n"));)
status = (aRefHash.Compare(*resBuf) == 0); //Compare the result with the hash to see if they match
}
}
CleanupStack::PopAndDestroy(resBuf);
break;
}
case EPKIDSA:
{
const TPtrC8 sigR = aSignature.Left(aSignature.Length() / 2);
const TPtrC8 sigS = aSignature.Right(aSignature.Length() / 2);
status = TUtlCrypto::DsaVerifySignatureL(publicKey->KeyData(),
publicKey->KeyParams(),
sigR, sigS, aRefHash);
break;
}
default: //Only RSA and DSA are valid
User::Invariant();
break;
}
CleanupStack::PopAndDestroy(publicKey);
//.........这里部分代码省略.........
示例9: ver
void CX509Certificate::ConstructCertL()
{
TPtrC8 signedData = SignedDataL();
TASN1DecSequence encSeq;
TInt pos = 0;
CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(signedData, pos, 6, KMaxTInt);//6 is the minimum number of elements in an x509 cert
TInt count = seq->Count();
pos = 0;
TASN1DecGeneric* curr = seq->At(pos);
pos++;
iDataElements = new(ELeave) TFixedArray<TPtrC8*, KX509MaxDataElements>;
iDataElements->Reset();
TPtrC8** pElement = iDataElements->Begin();
if ((curr->Class() == EContextSpecific) && (curr->Tag() == 0))
{
//version!
TASN1DecGeneric ver(curr->GetContentDER());
ver.InitL();
TPtrC8 pVer8 = ver.GetContentDER();
if(pVer8.Length() != 1)
{
User::Leave(KErrArgument);
}
iVersion = (pVer8[0]) + 1;
if ((iVersion < 1) || (iVersion > 3) || (count < 7))
{
User::Leave(KErrArgument);
}
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
curr = seq->At(pos);
pos++;
}
else
{
*pElement++ = NULL;
}
if (curr->Tag() != EASN1Integer)
{
User::Leave(KErrArgument);
}
iSerialNumber = (curr->GetContentDER()).AllocL();
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
curr = seq->At(pos);
pos++;
CX509SigningAlgorithmIdentifier* algorithmId = CX509SigningAlgorithmIdentifier::NewLC(curr->Encoding());
if (!(SigningAlgorithm() == *(algorithmId)))
{
User::Leave(KErrArgument);
}
CleanupStack::PopAndDestroy();//algorithmId
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
curr = seq->At(pos);
pos++;
iIssuerName = CX500DistinguishedName::NewL(curr->Encoding());
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
curr = seq->At(pos);
pos++;
iValidityPeriod = CX509ValidityPeriod::NewL(curr->Encoding());
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
curr = seq->At(pos);
pos++;
iSubjectName = CX500DistinguishedName::NewL(curr->Encoding());
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
curr = seq->At(pos);
pos++;
iSubjectPublicKeyInfo = CX509SubjectPublicKeyInfo::NewL(curr->Encoding());
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
//do issuer uid, subject uid, exts
//these are all optional
TBool hasIssuerUid = EFalse;
TBool hasSubjectUid = EFalse;
TBool hasExts = EFalse;
iExtensions = new(ELeave)CArrayPtrFlat<CX509CertExtension> (1);
if (pos < count)//otherwise there aren't any of 'em
{
curr = seq->At(pos);
pos++;
if (curr->Class() != EContextSpecific)
{
User::Leave(KErrArgument);
}
switch(curr->Tag())
{
case 1:
{
iIssuerUid = DecodeUidL(curr->GetContentDER(), hasIssuerUid);
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
break;
}
case 2:
{
iSubjectUid = DecodeUidL(curr->GetContentDER(), hasSubjectUid);
*pElement++ = NULL;
*pElement++ = new(ELeave) TPtrC8(curr->Encoding());
break;
}
case 3:
{
DecodeExtsL(curr->GetContentDER(), hasExts);
//.........这里部分代码省略.........
示例10: CreateXMLProfilesL
//===============================================
// CNSmlDSSettings::CreateXMLProfiles()
//
//
//===============================================
void CNSmlDSSettings::CreateXMLProfilesL(TBool aRestore)
{
TBool status = TRUE;
TInt error = KErrNone;
//file server
RFs wSession;
error = wSession.Connect();
if (error != KErrNone)
{
return;
}
RXMLReader DSProfileParser;
DSProfileParser.CreateL();
CArrayPtrFlat<CNSmlDSProfile>* customProfileArray = new (ELeave) CArrayPtrFlat<CNSmlDSProfile> (5);
CleanupStack::PushL(customProfileArray);
CNSmlProfileContentHandler* cb = CNSmlProfileContentHandler::NewL(this ,customProfileArray);
CleanupStack::PushL(cb);
DSProfileParser.SetContentHandler(cb);
DSProfileParser.SetFeature(EXMLValidation, ETrue);
DSProfileParser.SetFeature(EXMLValidation, EFalse);
DSProfileParser.GetFeature(EXMLBinary, status);
DSProfileParser.GetFeature(EXMLValidation, status);
status = TRUE;
RFile wFile;
TInt err =wFile.Open(wSession, Kinfile, EFileRead | EFileShareReadersOnly);
if (err != KErrNone)
{
CleanupStack::PopAndDestroy(2);
return;
}
CleanupClosePushL(wFile);
//parse file
TRAP(error, DSProfileParser.ParseL(wFile));
if (error != KErrNone)
{
CleanupStack::PopAndDestroy(3);
return;
}
TInt index;
TBuf<150> buf;
if(aRestore)
{
//handling back up-restore for custom profiles
CNSmlDSProfileList* profList = new (ELeave) CArrayPtrFlat<CNSmlDSProfileListItem>(1);
CleanupStack::PushL(profList);
GetAllProfileListL( profList );
for( TInt i = 0 ; i < profList->Count() ; i++ )
{
TInt id = profList->At(i)->IntValue( EDSProfileId );
CNSmlDSProfile* prof = ProfileL(id);
CleanupStack::PushL( prof );
buf = prof->StrValue(EDSProfileServerId);
if (buf.Compare(KEmpty) != 0)
{
for (index = 0; index < customProfileArray->Count(); index++ )
{
if (buf.Compare(customProfileArray->At(index)->StrValue(EDSProfileServerId)) == 0)
{
DeleteProfileL(id);
}
}
}
else
{
buf = prof->StrValue(EDSProfileServerURL);
for (index = 0; index < customProfileArray->Count(); index++ )
{
if (buf.Compare(customProfileArray->At(index)->StrValue(EDSProfileServerURL)) == 0)
{
DeleteProfileL(id);
}
}
}
CleanupStack::PopAndDestroy(); // prof
}
profList->ResetAndDestroy();
CleanupStack::PopAndDestroy();
}
//save profiles
TBool defaultprofilefound = EFalse;
//Set the ProfileID to default
//.........这里部分代码省略.........
示例11: oidDes
void CX509SigningAlgorithmIdentifier::ConstructL(const TDesC8& aBinaryData, TInt& aPos)
{
TASN1DecSequence encSeq;
CArrayPtrFlat<TASN1DecGeneric>* seq = encSeq.DecodeDERLC(aBinaryData, aPos, 1, KMaxTInt);
TInt count = seq->Count();
TASN1DecObjectIdentifier encOID;
HBufC* oid = encOID.DecodeDERL(*(seq->At(0)));
CleanupStack::PushL(oid);
TPtrC oidDes(oid->Des());
//none of the signing algorithms we support have parameters here...
HBufC8* encodedParams = HBufC8::NewLC(1);
*encodedParams = KNullDesC8;
if (oidDes == KDSAWithSHA1)
{
//should be no params, but we allow params encoded as NULL for interop reasons
TAlgorithmId algId = EDSA;
TAlgorithmId digestId = ESHA1;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
if (count == 1)
{
CleanupStack::PopAndDestroy(3);//seq, oid, encodedParams
return;
}
}
if (oidDes == KMD2WithRSA)
{
TAlgorithmId algId = ERSA;
TAlgorithmId digestId = EMD2;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
}
if (oidDes == KMD5WithRSA)
{
TAlgorithmId algId = ERSA;
TAlgorithmId digestId = EMD5;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
}
if (oidDes == KSHA1WithRSA || oidDes == KSHA1WithRSASignature)
{
TAlgorithmId algId = ERSA;
TAlgorithmId digestId = ESHA1;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
}
if (oidDes == KSHA224WithRSA)
{
TAlgorithmId algId = ERSA;
TAlgorithmId digestId = ESHA224;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
}
if (oidDes == KSHA256WithRSA)
{
TAlgorithmId algId = ERSA;
TAlgorithmId digestId = ESHA256;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
}
if (oidDes == KSHA384WithRSA)
{
TAlgorithmId algId = ERSA;
TAlgorithmId digestId = ESHA384;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
}
if (oidDes == KSHA512WithRSA)
{
TAlgorithmId algId = ERSA;
TAlgorithmId digestId = ESHA512;
iDigestAlgorithm = CAlgorithmIdentifier::NewL(digestId, encodedParams->Des());
iAsymmetricAlgorithm = CAlgorithmIdentifier::NewL(algId, encodedParams->Des());
}
//???not sure if we should just leave here...
if (iDigestAlgorithm == NULL)
{
User::Leave(KErrNotSupported);
}
else
{
if (count != 2)
{
// Shouldn't ever get here, since RFC2459 mandates having 2
// data items. However, some people miss out the second
// when it's NULL, so we'll not report and error here
}
else
{
TASN1DecGeneric* gen = seq->At(1);
TASN1DecNull null;
//.........这里部分代码省略.........
示例12: CreateDNL
// -----------------------------------------------------------------------------
// TSTSDistinguishedNameConverter::CreateDNL
// Create CX500DistinguishedName
// -----------------------------------------------------------------------------
CX500DistinguishedName* TSTSDistinguishedNameConverter::CreateDNL(
const TDesC& aNameInfo)
{
CArrayPtrFlat< CX520AttributeTypeAndValue>* elements =
new(ELeave) CArrayPtrFlat<CX520AttributeTypeAndValue> (1);
CleanupStack::PushL(elements);
CleanupResetAndDestroyPushL(*elements);
TInt pos(0);
TInt nameLength(aNameInfo.Length());
TInt elementStart(0);
while (pos < nameLength)
{
if (aNameInfo[ pos ] == '\\')
{
// next character is escaped, so we jump over it
pos++;
}
else if ((aNameInfo[ pos ] == ',') || (pos == (nameLength - 1)))
{
// found the end of single element, parse it
TInt elementLength = pos - elementStart;
if (pos == (nameLength - 1))
{
elementLength++;
}
TPtrC elementDes(aNameInfo.Mid(elementStart, elementLength));
CX520AttributeTypeAndValue* element =
ParseDNElementL(elementDes);
if (element)
{
CleanupStack::PushL(element);
elements->AppendL(element);
CleanupStack::Pop(); // element
}
elementStart = pos + 1;
}
pos++;
}
TInt elementCount = elements->Count();
if (elementCount == 0)
{
CX520AttributeTypeAndValue* element = GenerateDNElementLC();
elements->AppendL(element);
CleanupStack::Pop(); // element
elementCount++;
}
// In certificates the element order is reversed
CArrayPtrFlat< CX520AttributeTypeAndValue>* reversedElements =
new(ELeave) CArrayPtrFlat<CX520AttributeTypeAndValue> (elementCount);
CleanupStack::PushL(reversedElements);
for (TInt i = elementCount - 1; i >= 0; i--)
{
reversedElements->AppendL(elements->At(i));
}
CX500DistinguishedName* dn =
CX500DistinguishedName::NewL(*reversedElements);
CleanupStack::PopAndDestroy(3); // elements, reversedElements
return dn;
}
示例13: ComponentControl
CCoeControl* CUploadContainer::ComponentControl(TInt aIndex) const
{
CALLSTACKITEM_N(_CL("CUploadContainer"), _CL("ComponentControl"));
return iControls->At(aIndex);
}