vpnengine/utlpkcs10/src/pkcs10.cpp
branchRCL_3
changeset 41 e06095241a65
parent 40 473321461bba
equal deleted inserted replaced
40:473321461bba 41:e06095241a65
     1 /*
     1 /*
     2 * Copyright (c) 2003 - 2010 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2003 - 2007 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
  1040         CRInfoPtr += CPkcs10Req::DERSetLength(CRInfoPtr, requestInfoLength - coverSeqHeaderLength);
  1040         CRInfoPtr += CPkcs10Req::DERSetLength(CRInfoPtr, requestInfoLength - coverSeqHeaderLength);
  1041         CRInfoPtr += CPkcs10Req::DERSetTag(CRInfoPtr, EASN1Integer);
  1041         CRInfoPtr += CPkcs10Req::DERSetTag(CRInfoPtr, EASN1Integer);
  1042         CRInfoPtr += DERSetInteger(CRInfoPtr, 0);       // version
  1042         CRInfoPtr += DERSetInteger(CRInfoPtr, 0);       // version
  1043 
  1043 
  1044         // Copy component ders
  1044         // Copy component ders
  1045         if(commonAttributes->Length() > 0)
  1045         if(commonAttributes != NULL && commonAttributes->Length() > 0)
  1046             CRInfoPtr += CPkcs10Req::ASNCopy(CRInfoPtr, CONST_CAST(TUint8 *, commonAttributes->Ptr()), commonAttributes->Length());
  1046             CRInfoPtr += CPkcs10Req::ASNCopy(CRInfoPtr, CONST_CAST(TUint8 *, commonAttributes->Ptr()), commonAttributes->Length());
  1047 
  1047 
  1048         if(pkiInfo->Length() > 0)
  1048         if(pkiInfo != NULL && pkiInfo->Length() > 0)
  1049             CRInfoPtr += CPkcs10Req::ASNCopy(CRInfoPtr, CONST_CAST(TUint8 *, pkiInfo->Ptr()), pkiInfo->Length());
  1049             CRInfoPtr += CPkcs10Req::ASNCopy(CRInfoPtr, CONST_CAST(TUint8 *, pkiInfo->Ptr()), pkiInfo->Length());
  1050 
  1050 
  1051         if(extendedAttributes->Length() > 0)
  1051         if(extendedAttributes != NULL && extendedAttributes->Length() > 0)
  1052             CRInfoPtr += CPkcs10Req::ASNCopy(CRInfoPtr, CONST_CAST(TUint8 *, extendedAttributes->Ptr()), extendedAttributes->Length());
  1052             CRInfoPtr += CPkcs10Req::ASNCopy(CRInfoPtr, CONST_CAST(TUint8 *, extendedAttributes->Ptr()), extendedAttributes->Length());
  1053     }
  1053     }
  1054     
  1054     
  1055     CleanupStack::PopAndDestroy(extendedAttributes);
  1055     if(extendedAttributes != NULL)
  1056     CleanupStack::PopAndDestroy(pkiInfo);
  1056     {
  1057     CleanupStack::PopAndDestroy(commonAttributes);
  1057         delete extendedAttributes;
  1058    
  1058         CleanupStack::Pop(1);
       
  1059     }
       
  1060     if(pkiInfo != NULL)
       
  1061     {
       
  1062         delete pkiInfo;
       
  1063         CleanupStack::Pop(1);
       
  1064     }
       
  1065     if(commonAttributes != NULL)
       
  1066     {
       
  1067         delete commonAttributes;
       
  1068         CleanupStack::Pop(1);
       
  1069     }
  1059     if(CRInfoBuffer != NULL)
  1070     if(CRInfoBuffer != NULL)
  1060         CleanupStack::PushL(CRInfoBuffer);      // to be destroyed by the caller
  1071         CleanupStack::PushL(CRInfoBuffer);      // to be destroyed by the caller
  1061     
  1072     
  1062     return (CRInfoBuffer);
  1073     return (CRInfoBuffer);
  1063 }
  1074 }