cryptoservices/certificateandkeymgmt/asn1/genrlstrdec.cpp
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     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 implemenation of the General String ASN1 object.
       
    16 * The general string can contain the following characters:
       
    17 * <character set unknown pending arrival of ITU spec>
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 #include <asn1dec.h>
       
    23 
       
    24 EXPORT_C TASN1DecGeneralString::TASN1DecGeneralString(void)
       
    25 	{
       
    26 	}
       
    27 
       
    28 EXPORT_C TInt TASN1DecGeneralString::CheckValid(const TDesC8& /*aSource*/)
       
    29 
       
    30 	{
       
    31 	return KErrNone;
       
    32 	}
       
    33 
       
    34 EXPORT_C HBufC* TASN1DecGeneralString::DecodeDERL(const TDesC8& aSource,TInt& aPos)
       
    35 
       
    36 	{
       
    37 	TPtrC8 Source=aSource.Mid(aPos);
       
    38 	TASN1DecGeneric gen(Source);
       
    39 	gen.InitL();
       
    40 	HBufC* res = DecodeContentsL(gen.GetContentDER());
       
    41 	return res;
       
    42 	}
       
    43 
       
    44 HBufC* TASN1DecGeneralString::DecodeContentsL(const TDesC8& aSource)
       
    45 	{
       
    46 	HBufC* res = HBufC::NewL(aSource.Length());
       
    47 	TPtr pRes = res->Des();
       
    48 	pRes.Copy(aSource);
       
    49 	return res;
       
    50 	}