sl@0: /* sl@0: * Copyright (c) 1998-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 "asn1dec.h" sl@0: sl@0: EXPORT_C TASN1DecBoolean::TASN1DecBoolean(void) sl@0: { sl@0: } sl@0: sl@0: EXPORT_C TBool TASN1DecBoolean::DecodeDERL(const TDesC8& aSource,TInt& aPos) sl@0: sl@0: { sl@0: TPtrC8 Ptr=aSource.Right(aSource.Length()-aPos); sl@0: TASN1DecGeneric gen(Ptr); sl@0: gen.InitL(); sl@0: aPos+=gen.LengthDER(); sl@0: TBool res = DecodeDERL(gen); sl@0: return res; sl@0: } sl@0: sl@0: EXPORT_C TBool TASN1DecBoolean::DecodeDERL(const TASN1DecGeneric& aSource) sl@0: sl@0: { sl@0: TPtrC8 content = aSource.GetContentDER(); sl@0: if (content.Length() != 1) sl@0: { sl@0: User::Leave(KErrArgument); sl@0: } sl@0: if (content[0] == 0) sl@0: { sl@0: return EFalse; sl@0: } sl@0: if (content[0] == 0xFF) sl@0: { sl@0: return ETrue; sl@0: } sl@0: User::Leave(KErrArgument); sl@0: return ETrue;//never gets to here sl@0: }