os/security/cryptoservices/certificateandkeymgmt/asn1/nulldec.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of the License "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 * This file contains the implementation of the ASN1 Null class.
    16 *
    17 */
    18 
    19 
    20 #include "asn1dec.h"
    21 
    22 EXPORT_C TASN1DecNull::TASN1DecNull(void)
    23 	{
    24 	}
    25 
    26 EXPORT_C void TASN1DecNull::DecodeDERL(const TDesC8& aSource,TInt& aPos)
    27 
    28 	{
    29 	TPtrC8 Source=aSource.Mid(aPos);
    30 	TASN1DecGeneric gen(Source);
    31 	gen.InitL();
    32 	aPos+=gen.LengthDER();
    33 	DecodeDERL(gen);
    34 	}
    35 
    36 EXPORT_C void TASN1DecNull::DecodeDERL(const TASN1DecGeneric& aSource)
    37 	{
    38 	TPtrC8 contents(aSource.Encoding());
    39 	if ((contents.Length() != 2)	||
    40 		(contents[1] & 0xff)		||
    41 		(!(contents[0] & 0x05)))
    42 		{
    43 		User::Leave(KErrArgument);
    44 		}
    45 	}
    46