os/security/cryptoservices/certificateandkeymgmt/pkixCert/pkixCertChain.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 *
    16 */
    17 
    18 
    19 #include <pkixcertchain.h>
    20 #include <unifiedcertstore.h>
    21 #include <x509certext.h>
    22 #include "pkixCertChainHelper.h"
    23 
    24 //**********************************************************************************//
    25 EXPORT_C CPKIXCertChain* CPKIXCertChain::NewL(RFs& aFs,
    26 											  const TPtrC8& aEncodedCerts, 
    27 											  const TUid aClient)
    28 	{
    29 	CPKIXCertChain* self = CPKIXCertChain::NewLC(aFs, aEncodedCerts, aClient);
    30 	CleanupStack::Pop(self);
    31 	return self;
    32 	}
    33 
    34 EXPORT_C CPKIXCertChain* CPKIXCertChain::NewLC(RFs& aFs,
    35 											   const TPtrC8& aEncodedCerts,
    36 											   const TUid aClient)
    37 	{
    38 	CPKIXCertChain* self = new(ELeave) CPKIXCertChain();
    39 	CleanupStack::PushL(self);
    40 	self->ConstructL(aFs, aEncodedCerts, aClient);
    41 	return self;
    42 	}
    43 
    44 EXPORT_C CPKIXCertChain* CPKIXCertChain::NewL(RFs& aFs, 
    45 											  const TPtrC8& aEncodedCerts,
    46 											  const RPointerArray<CX509Certificate>& aRootCerts)
    47 	{
    48 	CPKIXCertChain* self = CPKIXCertChain::NewLC(aFs, aEncodedCerts, aRootCerts);
    49 	CleanupStack::Pop(self);
    50 	return self;
    51 	}
    52 
    53 EXPORT_C CPKIXCertChain* CPKIXCertChain::NewLC(RFs& aFs, 
    54 											   const TPtrC8& aEncodedCerts,
    55 											   const RPointerArray<CX509Certificate>& aRootCerts)
    56 	{
    57 	CPKIXCertChain* self = new(ELeave) CPKIXCertChain();
    58 	CleanupStack::PushL(self);
    59 	self->ConstructL(aFs, aEncodedCerts, aRootCerts);
    60 	return self;
    61 	}
    62 
    63 CPKIXCertChain::CPKIXCertChain() :
    64 	CPKIXCertChainBase()
    65 	{
    66 	}
    67 
    68 void CPKIXCertChain::ConstructL(RFs& aFs, const TPtrC8& aEncodedCerts, TUid aClient)
    69 	{
    70 	iHelper = CPKIXCertChainHelper::NewL(aFs);
    71 	CPKIXCertChainBase::ConstructL(iHelper->CertStore(), aEncodedCerts, aClient);
    72 	}
    73 
    74 void CPKIXCertChain::ConstructL(RFs& aFs, const TPtrC8& aEncodedCerts,
    75 								const RPointerArray<CX509Certificate>& aRootCerts)
    76 	{
    77 	iHelper = CPKIXCertChainHelper::NewL(aFs);
    78 	CPKIXCertChainBase::ConstructL(iHelper->CertStore(), aEncodedCerts, aRootCerts);
    79 	}
    80 
    81 EXPORT_C CPKIXCertChain::~CPKIXCertChain()
    82 	{
    83 	delete iHelper;
    84 	}
    85 
    86 EXPORT_C void CPKIXCertChain::ValidateL(CPKIXValidationResult& aValidationResult,
    87 										const TTime& aValidationTime,
    88 										TRequestStatus& aStatus)
    89 	{
    90 	// L in function name is to preserve BC - this can't leave
    91 	iHelper->Validate(*this, aValidationResult, aValidationTime, aStatus);
    92 	}
    93 
    94 EXPORT_C void CPKIXCertChain::ValidateL(CPKIXValidationResult& aValidationResult,
    95 										const TTime& aValidationTime,								 
    96 										const CArrayPtr<HBufC>& aInitialPolicies,
    97 										TRequestStatus& aStatus)
    98 	{
    99 	// L in function name is to preserve BC - this can't leave
   100 	iHelper->Validate(*this, aValidationResult, aValidationTime, aInitialPolicies, aStatus);
   101 	}
   102 
   103 EXPORT_C void CPKIXCertChain::CancelValidate()
   104 	{
   105 	iHelper->CancelValidate();
   106 	}
   107 
   108 EXPORT_C TBool CPKIXCertChain::ChainHasRoot() const
   109 	{
   110 	// This method is necessary to preserve BC
   111 	return CPKIXCertChainBase::ChainHasRoot();
   112 	}
   113 
   114 EXPORT_C void CPKIXCertChain::AddCertL(const TPtrC8& aEncodedCerts)
   115 	{
   116 	// This method is necessary to preserve BC
   117 	CPKIXCertChainBase::AddCertL(aEncodedCerts);
   118 	}
   119 
   120 EXPORT_C const RPointerArray<TDesC>& CPKIXCertChain::SupportedCriticalExtensions() const
   121 	{
   122 	return CPKIXCertChainBase::SupportedCriticalExtensions();
   123 	}
   124 
   125 EXPORT_C void CPKIXCertChain::AddSupportedCriticalExtensionsL(const RPointerArray<TDesC>& aCriticalExtOids)
   126 	{
   127 	CPKIXCertChainBase::AddSupportedCriticalExtensionsL(aCriticalExtOids);
   128 	}
   129 
   130 EXPORT_C void CPKIXCertChain::RemoveSupportedCriticalExtensions(const RPointerArray<TDesC>& aCriticalExtOids)
   131 	{
   132 	CPKIXCertChainBase::RemoveSupportedCriticalExtensions(aCriticalExtOids);
   133 	}
   134 
   135 EXPORT_C void CPKIXCertChain::SetSupportedCriticalExtensionsL(const RPointerArray<TDesC>& aCriticalExtOids)
   136 	{
   137 	CPKIXCertChainBase::SetSupportedCriticalExtensionsL(aCriticalExtOids);
   138 	}
   139 
   140 EXPORT_C void CPKIXCertChain::ResetSupportedCriticalExtsToDefaultL()
   141 	{
   142 	CPKIXCertChainBase::ResetSupportedCriticalExtsToDefaultL();
   143 	}
   144 	
   145 EXPORT_C void CPKIXCertChain::SetValidityPeriodCheckFatal(TBool aIsFatal)
   146 	{
   147 	CPKIXCertChainBase::SetValidityPeriodCheckFatal(aIsFatal);
   148 	}