|
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 CDmAdPrivKeyParms. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <utf.h> |
|
20 |
|
21 #include "dmadprivkeyparms.h" |
|
22 |
|
23 CDmAdPrivKeyParms* CDmAdPrivKeyParms::NewL() |
|
24 { |
|
25 CDmAdPrivKeyParms* self = NewLC(); |
|
26 CleanupStack::Pop(self); |
|
27 return self; |
|
28 } |
|
29 |
|
30 CDmAdPrivKeyParms* CDmAdPrivKeyParms::NewLC() |
|
31 { |
|
32 CDmAdPrivKeyParms* self = new (ELeave) CDmAdPrivKeyParms(); |
|
33 CleanupStack::PushL(self); |
|
34 return self; |
|
35 } |
|
36 |
|
37 CDmAdPrivKeyParms::CDmAdPrivKeyParms() |
|
38 { |
|
39 iKeyType = EPKIRSA; |
|
40 } |
|
41 |
|
42 CDmAdPrivKeyParms::~CDmAdPrivKeyParms() |
|
43 { |
|
44 delete iKeyId; |
|
45 } |
|
46 |
|
47 TPKIKeyAlgorithm CDmAdPrivKeyParms::KeyType() const |
|
48 { |
|
49 return iKeyType; |
|
50 } |
|
51 |
|
52 void CDmAdPrivKeyParms::SetKeyTypeL(TPKIKeyAlgorithm aKeyType) |
|
53 { |
|
54 |
|
55 if (aKeyType != EPKIRSA && |
|
56 aKeyType != EPKIDSA) |
|
57 { |
|
58 User::Leave(KErrCorrupt); |
|
59 } |
|
60 |
|
61 iKeyType = aKeyType; |
|
62 } |
|
63 |
|
64 TPtrC8 CDmAdPrivKeyParms::KeyId() const |
|
65 { |
|
66 TPtrC8 ret(KNullDesC8); |
|
67 if (iKeyId != 0) |
|
68 { |
|
69 ret.Set(*iKeyId); |
|
70 } |
|
71 return ret; |
|
72 } |
|
73 |
|
74 void CDmAdPrivKeyParms::SetKeyIdL(const TDesC8& aKeyId) |
|
75 { |
|
76 delete iKeyId; |
|
77 iKeyId = 0; |
|
78 if (aKeyId.Length() > 0) |
|
79 { |
|
80 iKeyId = aKeyId.AllocL(); |
|
81 } |
|
82 } |
|
83 |
|
84 TInt CDmAdPrivKeyParms::KeyLength() const |
|
85 { |
|
86 return iKeyLength; |
|
87 } |
|
88 |
|
89 void CDmAdPrivKeyParms::SetKeyLength(TInt aKeyLength) |
|
90 { |
|
91 iKeyLength = aKeyLength; |
|
92 } |
|
93 |