vpnengine/dmadpki/src/dmadcertreqparms.cpp
changeset 0 33413c0669b9
equal deleted inserted replaced
-1:000000000000 0:33413c0669b9
       
     1 /*
       
     2 * Copyright (c) 2002 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 CDmAdCertParms.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "dmadcertreqparms.h"
       
    20 #include "dmadstoreprivkey.h"
       
    21 
       
    22 CDmAdCertReqParms* CDmAdCertReqParms::NewL()
       
    23     {
       
    24     CDmAdCertReqParms* self = NewLC();
       
    25     CleanupStack::Pop(self);
       
    26     return self;
       
    27     }
       
    28 
       
    29 CDmAdCertReqParms* CDmAdCertReqParms::NewLC()
       
    30     {
       
    31     CDmAdCertReqParms* self = new (ELeave) CDmAdCertReqParms();
       
    32     CleanupStack::PushL(self);
       
    33     return self;
       
    34     }
       
    35 
       
    36 CDmAdCertReqParms::CDmAdCertReqParms()
       
    37     {
       
    38     }
       
    39     
       
    40 CDmAdCertReqParms::~CDmAdCertReqParms()
       
    41     {
       
    42     delete iSubjectName;
       
    43     delete iRfc822Name;
       
    44     delete iContent;
       
    45     delete iKeyIdentifierByUri; // key luid
       
    46     }
       
    47 
       
    48 TPtrC8 CDmAdCertReqParms::SubjectName() const
       
    49     {
       
    50     TPtrC8 ret(KNullDesC8);
       
    51     if (iSubjectName != 0)
       
    52         {
       
    53         ret.Set(*iSubjectName);
       
    54         }
       
    55     return ret;
       
    56     }
       
    57  
       
    58 void CDmAdCertReqParms::SetSubjectNameL(const TDesC8& aSubjectName)
       
    59     {
       
    60     delete iSubjectName;
       
    61     iSubjectName = 0;
       
    62     if (aSubjectName.Length() > 0)
       
    63         {
       
    64         iSubjectName = aSubjectName.AllocL();
       
    65         }
       
    66     }
       
    67 
       
    68 TPtrC8 CDmAdCertReqParms::Rfc822Name() const
       
    69     {
       
    70     TPtrC8 ret(KNullDesC8);
       
    71     if (iRfc822Name != 0)
       
    72         {
       
    73         ret.Set(*iRfc822Name);
       
    74         }
       
    75     return ret;
       
    76     }
       
    77  
       
    78 void CDmAdCertReqParms::SetRfc822NameL(const TDesC8& aRfc822Name)
       
    79     {
       
    80     delete iRfc822Name;
       
    81     iRfc822Name = 0;
       
    82     if (aRfc822Name.Length() > 0)
       
    83         {
       
    84         iRfc822Name = aRfc822Name.AllocL();
       
    85         }
       
    86     }
       
    87 
       
    88 TInt CDmAdCertReqParms::KeyLength() const
       
    89     {
       
    90     return iKeyLength;
       
    91     }
       
    92     
       
    93 void CDmAdCertReqParms::SetKeyLength(TInt aKeyLength)
       
    94     {
       
    95     iKeyLength = aKeyLength;
       
    96     }
       
    97  
       
    98 TPtrC8 CDmAdCertReqParms::Content() const
       
    99     {
       
   100     TPtrC8 ret(KNullDesC8);
       
   101     if (iContent != 0)
       
   102         {
       
   103         ret.Set(*iContent);
       
   104         }
       
   105     return ret;
       
   106     }
       
   107  
       
   108 void CDmAdCertReqParms::SetContentL(const TDesC8& aContent)
       
   109     {
       
   110     delete iContent;
       
   111     iContent = 0;
       
   112     if (aContent.Length() > 0)
       
   113         {
       
   114         iContent = aContent.AllocL();
       
   115         }
       
   116     }
       
   117 
       
   118 TPtrC8 CDmAdCertReqParms::KeyIdentifierByUri() const
       
   119     {
       
   120     TPtrC8 ret(KNullDesC8);
       
   121     if (iKeyIdentifierByUri != 0)
       
   122         {
       
   123         ret.Set(*iKeyIdentifierByUri);
       
   124         }
       
   125     return ret;
       
   126     }
       
   127  
       
   128 void CDmAdCertReqParms::SetKeyIdentifierByUriL(const TDesC8& aKeyIdentifierByUri)
       
   129     {
       
   130     delete iKeyIdentifierByUri;
       
   131     iKeyIdentifierByUri = 0;
       
   132     if (aKeyIdentifierByUri.Length() > 0)
       
   133         {
       
   134         iKeyIdentifierByUri = aKeyIdentifierByUri.AllocL();
       
   135         }
       
   136     }