vpnengine/dmadpki/src/dmadpkcs12parms.cpp
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2000-2008 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 "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:   Implementation of CDmAdPKCS12Parms
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #include <utf.h>
       
    23 
       
    24 #include "dmadpkcs12parms.h"
       
    25 #include "vpnlogger.h"
       
    26 
       
    27 CDmAdPKCS12Parms* CDmAdPKCS12Parms::NewL()
       
    28     {
       
    29     TRACE("CDmAdCertParms::NewL");
       
    30     
       
    31     CDmAdPKCS12Parms* self = NewLC();
       
    32     CleanupStack::Pop(self);
       
    33     return self;
       
    34     }
       
    35 
       
    36 CDmAdPKCS12Parms* CDmAdPKCS12Parms::NewLC()
       
    37     {
       
    38     CDmAdPKCS12Parms* self = new (ELeave) CDmAdPKCS12Parms();
       
    39     CleanupStack::PushL(self);
       
    40     return self;
       
    41     }
       
    42 
       
    43 CDmAdPKCS12Parms::CDmAdPKCS12Parms()
       
    44     {
       
    45     }
       
    46     
       
    47 CDmAdPKCS12Parms::~CDmAdPKCS12Parms()
       
    48     {
       
    49     TRACE("CDmAdCertParms::~CDmAdCertParms");
       
    50     
       
    51     iApplicability.Reset();
       
    52     iApplicability.Close();
       
    53     delete iContent;
       
    54     delete iPassword;
       
    55     }
       
    56     
       
    57 TBool CDmAdPKCS12Parms::Deletable() const
       
    58     {
       
    59     return iDeletable;
       
    60     }
       
    61     
       
    62 void CDmAdPKCS12Parms::SetDeletable(TBool aDeletable)
       
    63     {
       
    64     TRACE("CDmAdCertParms::SetDeletable");
       
    65     
       
    66     iDeletable = aDeletable;
       
    67     }
       
    68  
       
    69 const RArray<TUid>& CDmAdPKCS12Parms::Applicability() const
       
    70     {
       
    71     return iApplicability;
       
    72     }
       
    73  
       
    74 void CDmAdPKCS12Parms::SetApplicabilityL(const RArray<TUid>& aApplicability)
       
    75     {
       
    76     TRACE("CDmAdPKCS12Parms::SetApplicabilityL");
       
    77     
       
    78     iApplicability.Reset();
       
    79     
       
    80     for (TInt i = 0; i < aApplicability.Count(); ++i)
       
    81         {
       
    82         User::LeaveIfError(iApplicability.Append(aApplicability[i]));
       
    83         }
       
    84     }
       
    85 
       
    86 TPtrC8 CDmAdPKCS12Parms::Content() const
       
    87     {
       
    88     TPtrC8 ret(KNullDesC8);
       
    89     if (iContent != 0)
       
    90         {
       
    91         ret.Set(*iContent);
       
    92         }
       
    93     return ret;
       
    94     }
       
    95  
       
    96 void CDmAdPKCS12Parms::SetContentL(const TDesC8& aContent)
       
    97     {
       
    98     TRACE("CDmAdPKCS12Parms::SetContentL");
       
    99     
       
   100     delete iContent;
       
   101     iContent = 0;
       
   102     if (aContent.Length() > 0)
       
   103         {
       
   104         iContent = aContent.AllocL();
       
   105         }
       
   106     }
       
   107 
       
   108 TPtrC8 CDmAdPKCS12Parms::Password() const
       
   109     {
       
   110     TPtrC8 ret(KNullDesC8);
       
   111     if (iPassword)
       
   112         {
       
   113         ret.Set(*iPassword);
       
   114         }
       
   115     return ret;
       
   116     }
       
   117  
       
   118 void CDmAdPKCS12Parms::SetPasswordL(const TDesC8& aPassword)
       
   119     {
       
   120     TRACE("CDmAdPKCS12Parms::SetPasswordL");
       
   121 
       
   122     delete iPassword;
       
   123     iPassword = NULL;
       
   124     if (aPassword.Length() > 0)
       
   125         {
       
   126         iPassword = aPassword.AllocL();
       
   127         }
       
   128     else 
       
   129         {
       
   130         iPassword = HBufC8::NewL(0);
       
   131         }
       
   132     }
       
   133     
       
   134     
       
   135