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 "X509time.h" sl@0: sl@0: TASN1DecX509Time::TASN1DecX509Time() sl@0: sl@0: { sl@0: } sl@0: sl@0: TTime TASN1DecX509Time::DecodeDERL(const TDesC8& aSource,TInt& aPos) sl@0: sl@0: { sl@0: TPtrC8 Source=aSource.Mid(aPos); sl@0: TASN1DecGeneric Gen(Source); sl@0: Gen.InitL(); sl@0: aPos+=Gen.LengthDER(); sl@0: TTime t = TASN1DecX509Time::DecodeContentsL(Gen); sl@0: return t; sl@0: } sl@0: sl@0: TTime TASN1DecX509Time::DecodeDERL(const TASN1DecGeneric& aSource) sl@0: { sl@0: return DecodeContentsL(aSource); sl@0: } sl@0: sl@0: TTime TASN1DecX509Time::DecodeContentsL(const TASN1DecGeneric& aSource) sl@0: { sl@0: TTime result; sl@0: result.HomeTime(); sl@0: sl@0: switch (aSource.Tag()) sl@0: { sl@0: case EASN1UTCTime: sl@0: { sl@0: TASN1DecUTCTime encT; sl@0: result = encT.DecodeDERL(aSource); sl@0: break; sl@0: } sl@0: case EASN1GeneralizedTime: sl@0: { sl@0: TASN1DecGeneralizedTime encT; sl@0: result = encT.DecodeDERL(aSource); sl@0: break; sl@0: } sl@0: default: sl@0: User::Leave(KErrArgument); sl@0: break; sl@0: } sl@0: sl@0: return result; sl@0: }