1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/x509/X509time.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,67 @@
1.4 +/*
1.5 +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of the License "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#include "X509time.h"
1.23 +
1.24 +TASN1DecX509Time::TASN1DecX509Time()
1.25 +
1.26 + {
1.27 + }
1.28 +
1.29 +TTime TASN1DecX509Time::DecodeDERL(const TDesC8& aSource,TInt& aPos)
1.30 +
1.31 + {
1.32 + TPtrC8 Source=aSource.Mid(aPos);
1.33 + TASN1DecGeneric Gen(Source);
1.34 + Gen.InitL();
1.35 + aPos+=Gen.LengthDER();
1.36 + TTime t = TASN1DecX509Time::DecodeContentsL(Gen);
1.37 + return t;
1.38 + }
1.39 +
1.40 +TTime TASN1DecX509Time::DecodeDERL(const TASN1DecGeneric& aSource)
1.41 + {
1.42 + return DecodeContentsL(aSource);
1.43 + }
1.44 +
1.45 +TTime TASN1DecX509Time::DecodeContentsL(const TASN1DecGeneric& aSource)
1.46 + {
1.47 + TTime result;
1.48 + result.HomeTime();
1.49 +
1.50 + switch (aSource.Tag())
1.51 + {
1.52 + case EASN1UTCTime:
1.53 + {
1.54 + TASN1DecUTCTime encT;
1.55 + result = encT.DecodeDERL(aSource);
1.56 + break;
1.57 + }
1.58 + case EASN1GeneralizedTime:
1.59 + {
1.60 + TASN1DecGeneralizedTime encT;
1.61 + result = encT.DecodeDERL(aSource);
1.62 + break;
1.63 + }
1.64 + default:
1.65 + User::Leave(KErrArgument);
1.66 + break;
1.67 + }
1.68 +
1.69 + return result;
1.70 + }