sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
* PKCS#9 attributes for use in PKCS#10 Certificate Request creation
|
sl@0
|
16 |
*
|
sl@0
|
17 |
*/
|
sl@0
|
18 |
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file
|
sl@0
|
22 |
@publishedPartner
|
sl@0
|
23 |
@released
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
#if !defined (__PKCS9ATTR_H__)
|
sl@0
|
27 |
#define __PKCS9ATTR_H__
|
sl@0
|
28 |
|
sl@0
|
29 |
#include <x509cert.h>
|
sl@0
|
30 |
#include <pkcs10attr.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
// OID of PKCS#9 Challenge Password attribute
|
sl@0
|
33 |
_LIT(KPkcs9ChallengePasswordAttrOID, "1.2.840.113549.1.9.7");
|
sl@0
|
34 |
|
sl@0
|
35 |
// OID of PKCS#9 Extension Request attribute
|
sl@0
|
36 |
_LIT(KPkcs9ExtensionRequestAttrOID, "1.2.840.113549.1.9.14");
|
sl@0
|
37 |
|
sl@0
|
38 |
// Lower bound of password length for PKCS#9 Challenge Password attribute
|
sl@0
|
39 |
const TInt KPkcs9StringLB = 1;
|
sl@0
|
40 |
|
sl@0
|
41 |
// Upper bound of password length for PKCS#9 Challenge Password attribute
|
sl@0
|
42 |
const TInt KPkcs9StringUB = 255;
|
sl@0
|
43 |
|
sl@0
|
44 |
/**
|
sl@0
|
45 |
Class representing a PKCS#9 Challenge Password attribute.
|
sl@0
|
46 |
*/
|
sl@0
|
47 |
class CPKCS9ChallengePasswordAttr : public CPKCSAttributeBase
|
sl@0
|
48 |
{
|
sl@0
|
49 |
public:
|
sl@0
|
50 |
|
sl@0
|
51 |
/** Create a PKCS#9 Challenge Password attribute with the given password, leaving it on
|
sl@0
|
52 |
the cleanup stack.
|
sl@0
|
53 |
@param aPassword The password - should be a Printable String with an upper bound
|
sl@0
|
54 |
length of 255 characters and lower bound of 1 character.
|
sl@0
|
55 |
@return New Challenge Password attribute object
|
sl@0
|
56 |
*/
|
sl@0
|
57 |
IMPORT_C static CPKCS9ChallengePasswordAttr* NewLC(const TDesC8& aPassword);
|
sl@0
|
58 |
|
sl@0
|
59 |
/** Create a PKCS#9 Challenge Password attribute with the given password.
|
sl@0
|
60 |
@param aPassword The password - should be a Printable String with an upper bound
|
sl@0
|
61 |
length of 255 characters and lower bound of 1 character.
|
sl@0
|
62 |
@return New Challenge Password attribute object
|
sl@0
|
63 |
*/
|
sl@0
|
64 |
IMPORT_C static CPKCS9ChallengePasswordAttr* NewL(const TDesC8& aPassword);
|
sl@0
|
65 |
|
sl@0
|
66 |
/** Reset method to allow for re-use of the attribute object.
|
sl@0
|
67 |
@param aPassword The password - should be a Printable String with an upper bound
|
sl@0
|
68 |
length of 255 characters and lower bound of 1 character.
|
sl@0
|
69 |
*/
|
sl@0
|
70 |
IMPORT_C void ResetL(const TDesC8& aPassword);
|
sl@0
|
71 |
|
sl@0
|
72 |
/** Get the ASN.1 encoding of the attribute and relinquish ownership of it,
|
sl@0
|
73 |
leaving it on the cleanup stack. This is called by CPKCS10Attribtues
|
sl@0
|
74 |
when AddAttribute() is called. Note that this method cannot be reused unless
|
sl@0
|
75 |
Reset() has been called.
|
sl@0
|
76 |
@panic E32USER-CBase:66 if a stack frame for the next PushL() cannot be allocated.
|
sl@0
|
77 |
@return ASN.1 encoding object
|
sl@0
|
78 |
*/
|
sl@0
|
79 |
CASN1EncBase* GetEncodingLC();
|
sl@0
|
80 |
|
sl@0
|
81 |
virtual ~CPKCS9ChallengePasswordAttr();
|
sl@0
|
82 |
|
sl@0
|
83 |
private:
|
sl@0
|
84 |
CPKCS9ChallengePasswordAttr();
|
sl@0
|
85 |
void ConstructL(const TDesC8& aPassword);
|
sl@0
|
86 |
};
|
sl@0
|
87 |
|
sl@0
|
88 |
/**
|
sl@0
|
89 |
Class representing a collection of one or more X.509 Certificate Extension attributes.
|
sl@0
|
90 |
*/
|
sl@0
|
91 |
class CPKCS9ExtensionRequestAttr : public CPKCSAttributeBase
|
sl@0
|
92 |
{
|
sl@0
|
93 |
public:
|
sl@0
|
94 |
|
sl@0
|
95 |
/** Create a PKCS#9 Extensions attribute with the a single extension, leaving it on
|
sl@0
|
96 |
the cleanup stack.
|
sl@0
|
97 |
@param aExtension An X.509 Certificate Extension object.
|
sl@0
|
98 |
@return New PKCS#9 Extensions attribute object
|
sl@0
|
99 |
*/
|
sl@0
|
100 |
IMPORT_C static CPKCS9ExtensionRequestAttr* NewLC(const CX509CertExtension& aExtension);
|
sl@0
|
101 |
|
sl@0
|
102 |
/** Create a PKCS#9 Extensions attribute with the a single extension.
|
sl@0
|
103 |
@param aExtension An X.509 Certificate Extension object.
|
sl@0
|
104 |
@return New PKCS#9 Extensions attribute object
|
sl@0
|
105 |
*/
|
sl@0
|
106 |
IMPORT_C static CPKCS9ExtensionRequestAttr* NewL(const CX509CertExtension& aExtension);
|
sl@0
|
107 |
|
sl@0
|
108 |
/** Adds an extension to the extensions attribute.
|
sl@0
|
109 |
@param aExtension An X.509 Certificate Extension object.
|
sl@0
|
110 |
*/
|
sl@0
|
111 |
IMPORT_C void AddExtensionL(const CX509CertExtension& aExtension);
|
sl@0
|
112 |
|
sl@0
|
113 |
/** Reset method to allow for re-use of the attribute object. Already existing
|
sl@0
|
114 |
extensions are removed.
|
sl@0
|
115 |
@param aExtension An X.509 Certificate Extension object.
|
sl@0
|
116 |
*/
|
sl@0
|
117 |
IMPORT_C void ResetL(const CX509CertExtension& aExtension);
|
sl@0
|
118 |
|
sl@0
|
119 |
virtual ~CPKCS9ExtensionRequestAttr();
|
sl@0
|
120 |
|
sl@0
|
121 |
/** Get the ASN.1 encoding of the attribute and relinquish ownership of it,
|
sl@0
|
122 |
leaving it on the cleanup stack. This is called by CPKCS10Attribtues
|
sl@0
|
123 |
when AddAttribute() is called. Note that this method cannot be reused unless
|
sl@0
|
124 |
Reset() has been called.
|
sl@0
|
125 |
@panic E32USER-CBase:66 if a stack frame for the next PushL() cannot be allocated.
|
sl@0
|
126 |
@return ASN.1 encoding object
|
sl@0
|
127 |
*/
|
sl@0
|
128 |
CASN1EncBase* GetEncodingLC();
|
sl@0
|
129 |
|
sl@0
|
130 |
private:
|
sl@0
|
131 |
CPKCS9ExtensionRequestAttr();
|
sl@0
|
132 |
void ConstructL(const CX509CertExtension& aExtension);
|
sl@0
|
133 |
|
sl@0
|
134 |
private:
|
sl@0
|
135 |
CASN1EncSequence* iExtSeq;
|
sl@0
|
136 |
};
|
sl@0
|
137 |
|
sl@0
|
138 |
#endif // __PKCS9ATTR_H__
|