Update contrib.
2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * PKCS#9 attributes for use in PKCS#10 Certificate Request creation
26 #if !defined (__PKCS9ATTR_H__)
27 #define __PKCS9ATTR_H__
30 #include <pkcs10attr.h>
32 // OID of PKCS#9 Challenge Password attribute
33 _LIT(KPkcs9ChallengePasswordAttrOID, "1.2.840.113549.1.9.7");
35 // OID of PKCS#9 Extension Request attribute
36 _LIT(KPkcs9ExtensionRequestAttrOID, "1.2.840.113549.1.9.14");
38 // Lower bound of password length for PKCS#9 Challenge Password attribute
39 const TInt KPkcs9StringLB = 1;
41 // Upper bound of password length for PKCS#9 Challenge Password attribute
42 const TInt KPkcs9StringUB = 255;
45 Class representing a PKCS#9 Challenge Password attribute.
47 class CPKCS9ChallengePasswordAttr : public CPKCSAttributeBase
51 /** Create a PKCS#9 Challenge Password attribute with the given password, leaving it on
53 @param aPassword The password - should be a Printable String with an upper bound
54 length of 255 characters and lower bound of 1 character.
55 @return New Challenge Password attribute object
57 IMPORT_C static CPKCS9ChallengePasswordAttr* NewLC(const TDesC8& aPassword);
59 /** Create a PKCS#9 Challenge Password attribute with the given password.
60 @param aPassword The password - should be a Printable String with an upper bound
61 length of 255 characters and lower bound of 1 character.
62 @return New Challenge Password attribute object
64 IMPORT_C static CPKCS9ChallengePasswordAttr* NewL(const TDesC8& aPassword);
66 /** Reset method to allow for re-use of the attribute object.
67 @param aPassword The password - should be a Printable String with an upper bound
68 length of 255 characters and lower bound of 1 character.
70 IMPORT_C void ResetL(const TDesC8& aPassword);
72 /** Get the ASN.1 encoding of the attribute and relinquish ownership of it,
73 leaving it on the cleanup stack. This is called by CPKCS10Attribtues
74 when AddAttribute() is called. Note that this method cannot be reused unless
75 Reset() has been called.
76 @panic E32USER-CBase:66 if a stack frame for the next PushL() cannot be allocated.
77 @return ASN.1 encoding object
79 CASN1EncBase* GetEncodingLC();
81 virtual ~CPKCS9ChallengePasswordAttr();
84 CPKCS9ChallengePasswordAttr();
85 void ConstructL(const TDesC8& aPassword);
89 Class representing a collection of one or more X.509 Certificate Extension attributes.
91 class CPKCS9ExtensionRequestAttr : public CPKCSAttributeBase
95 /** Create a PKCS#9 Extensions attribute with the a single extension, leaving it on
97 @param aExtension An X.509 Certificate Extension object.
98 @return New PKCS#9 Extensions attribute object
100 IMPORT_C static CPKCS9ExtensionRequestAttr* NewLC(const CX509CertExtension& aExtension);
102 /** Create a PKCS#9 Extensions attribute with the a single extension.
103 @param aExtension An X.509 Certificate Extension object.
104 @return New PKCS#9 Extensions attribute object
106 IMPORT_C static CPKCS9ExtensionRequestAttr* NewL(const CX509CertExtension& aExtension);
108 /** Adds an extension to the extensions attribute.
109 @param aExtension An X.509 Certificate Extension object.
111 IMPORT_C void AddExtensionL(const CX509CertExtension& aExtension);
113 /** Reset method to allow for re-use of the attribute object. Already existing
114 extensions are removed.
115 @param aExtension An X.509 Certificate Extension object.
117 IMPORT_C void ResetL(const CX509CertExtension& aExtension);
119 virtual ~CPKCS9ExtensionRequestAttr();
121 /** Get the ASN.1 encoding of the attribute and relinquish ownership of it,
122 leaving it on the cleanup stack. This is called by CPKCS10Attribtues
123 when AddAttribute() is called. Note that this method cannot be reused unless
124 Reset() has been called.
125 @panic E32USER-CBase:66 if a stack frame for the next PushL() cannot be allocated.
126 @return ASN.1 encoding object
128 CASN1EncBase* GetEncodingLC();
131 CPKCS9ExtensionRequestAttr();
132 void ConstructL(const CX509CertExtension& aExtension);
135 CASN1EncSequence* iExtSeq;
138 #endif // __PKCS9ATTR_H__