os/security/cryptoservices/certificateandkeymgmt/asn1/visiblstdec.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 visible string ASN1 object.
    16 * The visible string can contain the following characters:
    17 * <character set currently unknown, awaiting arrival of ITU specs>
    18 *
    19 */
    20 
    21 
    22 #include <asn1dec.h>
    23 
    24 EXPORT_C TASN1DecVisibleString::TASN1DecVisibleString(void)
    25 	{
    26 	}
    27 
    28 EXPORT_C TInt TASN1DecVisibleString::CheckValid(const TDesC8& /*aSource*/)
    29 	{
    30 	return KErrNone;
    31 	}
    32 
    33 EXPORT_C HBufC* TASN1DecVisibleString::DecodeDERL(const TDesC8& aSource,TInt& aPos)
    34 	{
    35 	TPtrC8 Source=aSource.Mid(aPos);
    36 	TASN1DecGeneric gen(Source);
    37 	gen.InitL();
    38 	HBufC* res = DecodeContentsL(gen.GetContentDER());
    39 	aPos+=gen.LengthDER();
    40 	return res;
    41 	}
    42 
    43 HBufC* TASN1DecVisibleString::DecodeContentsL(const TDesC8& aSource)
    44 	{
    45 	HBufC* res = HBufC::NewL(aSource.Length());
    46 	TPtr pRes = res->Des();
    47 	pRes.Copy(aSource);
    48 	return res;
    49 	}