|
1 /* |
|
2 * Copyright (c) 2004 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: Header file of the abstract PKCS#12 parser API |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MPKCS12_H__ |
|
20 #define __MPKCS12_H__ |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <e32base.h> |
|
25 #include <f32file.h> |
|
26 |
|
27 // CONSTANTS |
|
28 // Minimum data length needed to recognize PKCS#12 data. |
|
29 const TInt KPKCS12DataMinLength = 49; |
|
30 |
|
31 // FORWARD DECLARATIONS |
|
32 class CX509Certificate; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 |
|
36 /** |
|
37 * Class MPKCS12 |
|
38 * The MPKCS12 abstract base class for opening a PKCS #12 file. |
|
39 * PKCS #12 is a format used to store and protect user's |
|
40 * private data, i.e. his/her key pairs, certificates and other personal |
|
41 * information. |
|
42 * |
|
43 * @since Series 60 3.0 |
|
44 */ |
|
45 class MPKCS12 |
|
46 { |
|
47 public: // Functions |
|
48 |
|
49 /** |
|
50 * Executes actual parsing. |
|
51 * @param aPKCS12 PKCS#12 encoded data |
|
52 * @param aPassword Used to generate encryption key. |
|
53 * @return ?description |
|
54 */ |
|
55 virtual void ParseL(const TDesC8& aPKCS12, const TDesC16& aPassword) = 0; |
|
56 |
|
57 /** |
|
58 * ?member_description. |
|
59 * @since Series ?XX ?SeriesXX_version |
|
60 * @param ?arg1 ?description |
|
61 * @return ?description |
|
62 */ |
|
63 virtual const CArrayPtr<CX509Certificate>& CACertificates() const = 0; |
|
64 virtual const CArrayPtr<CX509Certificate>& UserCertificates() const = 0; |
|
65 virtual const CArrayPtr<HBufC8>& PrivateKeys() const = 0; |
|
66 |
|
67 // Returns number of SafeBags in PKCS #12 file. |
|
68 virtual TUint SafeBagsCount() const = 0; |
|
69 // Returns the number of iterations. |
|
70 virtual TUint IterCount() const = 0; |
|
71 |
|
72 /** |
|
73 * Frees resources of the MPKCS12 class |
|
74 */ |
|
75 virtual void Release()=0; |
|
76 |
|
77 /** |
|
78 * Recognizes PKCS#12 data |
|
79 * @param aPKCS12 PKCS#12 encoded data |
|
80 * @return ETrue if data is recognized as PKCS12, |
|
81 * otherwise EFalse. |
|
82 */ |
|
83 virtual TBool IsPKCS12Data(const TDesC8& aBinaryData) = 0; |
|
84 |
|
85 protected: // Destructor |
|
86 |
|
87 /** |
|
88 * Destructor. |
|
89 */ |
|
90 inline virtual ~MPKCS12() |
|
91 {}; |
|
92 |
|
93 }; |
|
94 |
|
95 |
|
96 /** |
|
97 * Factory for creating the relevant concrete subclass of the pkcs#12 base class. |
|
98 */ |
|
99 class PKCS12Factory |
|
100 { |
|
101 public: |
|
102 /** |
|
103 * Creates an instance of a subclass of MPKCS12. Implement to create |
|
104 * the appropriate PKCS#12 parser |
|
105 * |
|
106 * @return An object that implements MPKCS12 functions |
|
107 */ |
|
108 IMPORT_C static MPKCS12* CreateL(); |
|
109 }; |
|
110 |
|
111 #endif // __MPKCS12_H__ |
|
112 |
|
113 // End of File |