sl@0: /* sl@0: * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include "pkcs7asn1.h" sl@0: #include sl@0: sl@0: CArrayPtr* PKCS7ASN1::DecodeSequenceLC(const TDesC8& aRawData) sl@0: { sl@0: CArrayPtr* items = NULL; sl@0: sl@0: // Check we've got a sequence sl@0: TASN1DecGeneric decGen(aRawData); sl@0: decGen.InitL(); sl@0: if(decGen.Tag() != EASN1Sequence && decGen.Tag() != EASN1Set) sl@0: { sl@0: User::Leave(KErrArgument); sl@0: } sl@0: else sl@0: { sl@0: // Decode the sequence sl@0: TASN1DecSequence decSeq; sl@0: items = decSeq.DecodeDERLC(decGen); sl@0: } sl@0: return items; sl@0: } sl@0: sl@0: CArrayPtr* PKCS7ASN1::DecodeSequenceLC(const TDesC8& aRawData, sl@0: const TInt aMinTerms, sl@0: const TInt aMaxTerms) sl@0: { sl@0: CArrayPtr* items = DecodeSequenceLC(aRawData); sl@0: TInt count = items->Count(); sl@0: if(count < aMinTerms || count > aMaxTerms) sl@0: { sl@0: User::Leave(KErrArgument); sl@0: } sl@0: sl@0: return items; sl@0: }