os/security/cryptoservices/certificateandkeymgmt/inc/cmssigneridentifier.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/inc/cmssigneridentifier.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,209 @@
     1.4 +/*
     1.5 +* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +/**
    1.23 + @file
    1.24 + @publishedPartner
    1.25 + @released
    1.26 +*/
    1.27 +
    1.28 +#ifndef CMSSIGNERIDENTIFIER_H
    1.29 +#define CMSSIGNERIDENTIFIER_H
    1.30 +
    1.31 +#include <e32base.h>
    1.32 +#include <pkcs7issuerserial.h>
    1.33 +
    1.34 +class CX500DistinguishedName;
    1.35 +class CX509SubjectKeyIdExt;
    1.36 +class CASN1EncSequence;
    1.37 +class CASN1EncBase;
    1.38 +
    1.39 +
    1.40 +/**
    1.41 + A representation of a RFC2630 (SignerIdentifier) entity.
    1.42 + */
    1.43 +class CCmsSignerIdentifier : public CBase
    1.44 +	{
    1.45 +public:
    1.46 +
    1.47 +	/**
    1.48 +	The SignerIdentifier type.
    1.49 +	*/
    1.50 +	enum TSignerIdentifierType
    1.51 +		{
    1.52 +		/** The SignerIdentifier type is issuerAndSerialNumber. */
    1.53 +		EIssuerAndSerialNumber,
    1.54 +		/** The SignerIdentifier type is subjectKeyIdentifier. */
    1.55 +		ESubjectKeyIdentifier
    1.56 +		};
    1.57 +
    1.58 +	/**
    1.59 +	 * @internalComponent
    1.60 +	 * 
    1.61 +	 * Creates a CMS SignerIdentifier as defined in RFC2630.
    1.62 +	 * @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
    1.63 +	 *	this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
    1.64 +	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
    1.65 +	 *	not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling 
    1.66 +	 *	this method, and pop it off the cleanup stack after successful construction.
    1.67 +	 *  @return The fully constructed object.
    1.68 +	 **/
    1.69 +	static CCmsSignerIdentifier* NewL(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
    1.70 +	
    1.71 +	/**
    1.72 +	 * @internalComponent
    1.73 +	 *
    1.74 +	 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
    1.75 +	 * @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
    1.76 +	 *	this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
    1.77 +	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
    1.78 +	 *	not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling 
    1.79 +	 *	this method, and pop it off the cleanup stack after successful construction.
    1.80 +	 * @return The fully constructed object.
    1.81 +	 **/	
    1.82 +	static CCmsSignerIdentifier* NewLC(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
    1.83 +	
    1.84 +	/**
    1.85 +	 * @internalComponent
    1.86 +	 * 
    1.87 +	 * Creates a CMS SignerIdentifier as defined in RFC2630.
    1.88 +	 * @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
    1.89 +	 *	Ownership of aSubjectKeyIdExt is transferred to the newly
    1.90 +	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
    1.91 +	 *	not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling 
    1.92 +	 *	this method, and pop it off the cleanup stack after successful construction.
    1.93 +	 * @return The fully constructed object.
    1.94 +	 **/
    1.95 +	static CCmsSignerIdentifier* NewL(HBufC8* aSubjectKeyIdExt);
    1.96 +	
    1.97 +	/**
    1.98 +	 * @internalComponent
    1.99 +	 * 
   1.100 +	 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
   1.101 +	 * @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
   1.102 +	 *	Ownership of aSubjectKeyIdExt is transferred to the newly
   1.103 +	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
   1.104 +	 *	not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling 
   1.105 +	 *	this method, and pop it off the cleanup stack after successful construction.
   1.106 +	 * @return The fully constructed object
   1.107 +	 **/		
   1.108 +	static CCmsSignerIdentifier* NewLC(HBufC8* aSubjectKeyIdExt);
   1.109 +	
   1.110 +	/**
   1.111 +	 * @internalComponent
   1.112 +	 *
   1.113 +	 * Creates a CMS SignerIdentifier as defined in RFC2630.
   1.114 +	 * @param aRawData A buffer that contains the encoded CMS signer identifier.
   1.115 +	 * @return The fully constructed object.
   1.116 +	 **/			
   1.117 +	static CCmsSignerIdentifier* NewL(const TDesC8& aRawData);
   1.118 +	
   1.119 +	/**
   1.120 +	 * @internalComponent
   1.121 +	 *
   1.122 +	 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
   1.123 +	 * @param aRawData A buffer that contains the encoded CMS signer identifier.
   1.124 +	 * @return The fully constructed object.
   1.125 +	 **/				
   1.126 +	static CCmsSignerIdentifier* NewLC(const TDesC8& aRawData);
   1.127 +	
   1.128 +	/**
   1.129 +	Destructor
   1.130 +	*/
   1.131 +	IMPORT_C ~CCmsSignerIdentifier();
   1.132 +	
   1.133 +	/**
   1.134 +	 * @internalComponent
   1.135 +	 *
   1.136 +	 * Creates the ASN1 sequence of the signer identifier object and leaves it on the cleanup stack.
   1.137 +	 * @return ASN1 sequence of this object.
   1.138 +	 */	
   1.139 +	CASN1EncBase* EncodeASN1DERLC() const;
   1.140 +
   1.141 +	/**
   1.142 +	Returns the issuer and serial name.
   1.143 +	@return The CPKCS7IssuerAndSerialNumber reference. NULL if the signer 
   1.144 +	identifier type is subjectKeyIdentifier. The signer identifier type can be retrieved
   1.145 +	using SignerIdentifierType().
   1.146 +	*/		
   1.147 +	IMPORT_C const CPKCS7IssuerAndSerialNumber* IssuerAndSerialNumber() const;
   1.148 +	
   1.149 +	/**
   1.150 +	Returns the subject key identifier.
   1.151 +	@return The subject key identifier reference. KNullDesC8 if the signer 
   1.152 +	identifier type is issuerAndSerialNumber. The signer identifier type can 
   1.153 +	be retrieved using SignerIdentifierType().
   1.154 +	*/	
   1.155 +	IMPORT_C const TDesC8& SubjectKeyIdentifier() const;
   1.156 +	
   1.157 +	/**
   1.158 +	Returns the type of the signer identifier.
   1.159 +	@return The type of the signer identifier. See the TSignerIdentifierType enum.
   1.160 +	*/		
   1.161 +	IMPORT_C TInt SignerIdentifierType() const;
   1.162 +	
   1.163 +protected:
   1.164 +	/**
   1.165 +	 * @internalComponent
   1.166 +	 * 
   1.167 +	 * Default constructor
   1.168 +	 **/
   1.169 +	CCmsSignerIdentifier();
   1.170 +	
   1.171 +	/**
   1.172 +	 * @internalComponent
   1.173 +	 *
   1.174 +	 * Constructor for encoding.
   1.175 +	 * @param aIssuerAndSerialNumber The issuer and serial number.
   1.176 +	 **/
   1.177 +	CCmsSignerIdentifier(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
   1.178 +	
   1.179 +	/**
   1.180 +	 * @internalComponent
   1.181 +	 *
   1.182 +	 * Constructor for encoding
   1.183 +	 * @param aSubjectKeyIdExt the subject key identifier extension
   1.184 +	 **/	
   1.185 +	CCmsSignerIdentifier(HBufC8* aSubjectKeyIdExt);
   1.186 +	
   1.187 +	/**
   1.188 +	 * @internalComponent
   1.189 +	 *
   1.190 +	 * Second phase constructor for encoding
   1.191 +	 * @param aRawData the raw data
   1.192 +	 **/		
   1.193 +	void ConstructL(const TDesC8& aRawData);
   1.194 +
   1.195 +private:
   1.196 +	/**
   1.197 +	The type of the signer identifier.
   1.198 +	*/
   1.199 +	TSignerIdentifierType iSignerIdentifierType;
   1.200 +	
   1.201 +	/**
   1.202 +	The issuer and serial number
   1.203 +	*/	
   1.204 +	CPKCS7IssuerAndSerialNumber* iIssuerAndSerialNumber;
   1.205 +	
   1.206 +	/**
   1.207 +	The subject key identifier.
   1.208 +	*/
   1.209 +	HBufC8* iSubjectKeyIdExt;
   1.210 +	};	
   1.211 +	
   1.212 +#endif //CMSSIGNERIDENTIFIER_H