|
1 /* |
|
2 * Copyright (c) 2005-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 |
|
20 |
|
21 /** |
|
22 @file |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 |
|
27 #ifndef __PKCS12ATTRIBUTE_H__ |
|
28 #define __PKCS12ATTRIBUTE_H__ |
|
29 |
|
30 #include <asn1dec.h> |
|
31 |
|
32 namespace PKCS12 |
|
33 { |
|
34 /** |
|
35 This class decodes the bagAttributes present in the SafeBag. |
|
36 It has methods to get the AttributeId and the AttributeValue. |
|
37 */ |
|
38 class CDecPkcs12Attribute : public CBase |
|
39 { |
|
40 public: |
|
41 /** |
|
42 Creates a new PKCS#12 attribute object. |
|
43 |
|
44 PKCS#12AttrSet ATTRIBUTE ::= { |
|
45 friendlyName | |
|
46 localKeyId, |
|
47 ... -- Other attributes are allowed |
|
48 } |
|
49 |
|
50 @param aBagAttributes Contains a PKCS#12 attribute set. |
|
51 @return A pointer to the newly allocated object. |
|
52 @leave if the bag attribute set is not a sequence or class |
|
53 tag name is not Universal. |
|
54 */ |
|
55 IMPORT_C static CDecPkcs12Attribute* NewL(const TDesC8& aBagAttributes); |
|
56 |
|
57 /** |
|
58 Returns the ObjectIdentifier indicating the attribute type: |
|
59 - OID ---- 1.2.840.113549.1.9.20 friendlyName |
|
60 - OID ---- 1.2.840.113549.1.9.21 localKeyId |
|
61 @return An object identifier indicating the attribute type. |
|
62 */ |
|
63 IMPORT_C const TDesC& AttributeId() const; |
|
64 |
|
65 /** |
|
66 Returns the DER encoded attribute values present in the Safe Bag. |
|
67 @return The ASN1Set of attribute values |
|
68 */ |
|
69 IMPORT_C const RPointerArray<TDesC8>& AttributeValue() const; |
|
70 |
|
71 /** |
|
72 Destructor. |
|
73 */ |
|
74 virtual ~CDecPkcs12Attribute(); |
|
75 |
|
76 private: |
|
77 /** |
|
78 This decodes the entire BagAttributes structure |
|
79 @param aBagAttributes Contains a PKCS#12 attribute set. |
|
80 @leave if the bag attribute set is not a sequence or class |
|
81 tag name is not Universal. |
|
82 */ |
|
83 void ConstructL(const TDesC8& aBagAttributes); |
|
84 |
|
85 /** |
|
86 Construtor. |
|
87 */ |
|
88 CDecPkcs12Attribute(); |
|
89 |
|
90 /** |
|
91 Copy Constructor. |
|
92 @param aDecPkcs12Atrribute A CDecPkcs12Attribute object. |
|
93 */ |
|
94 CDecPkcs12Attribute(const CDecPkcs12Attribute& aDecPkcs12Atrribute); |
|
95 |
|
96 /** |
|
97 Assignment operator. |
|
98 @param aDecPkcs12Atrribute A CDecPkcs12Attribute object. |
|
99 @return A reference to CDecPkcs12Attribute class. |
|
100 */ |
|
101 CDecPkcs12Attribute& operator=(const CDecPkcs12Attribute& aDecPkcs12Atrribute); |
|
102 |
|
103 private: |
|
104 /** Contains the object identifier indicating the attribute type */ |
|
105 HBufC* iAttributeId; |
|
106 |
|
107 /** Contains the attribute value which is an DER encoded value */ |
|
108 RPointerArray<TDesC8> iAttributeValue; |
|
109 }; |
|
110 } // namespace PKCS12 |
|
111 #endif // __PKCS12ATTRIBUTE_H__ |