cryptoservices/certificateandkeymgmt/inc/cmssigneridentifier.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 /*
       
     2 * Copyright (c) 2006-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 CMSSIGNERIDENTIFIER_H
       
    28 #define CMSSIGNERIDENTIFIER_H
       
    29 
       
    30 #include <e32base.h>
       
    31 #include <pkcs7issuerserial.h>
       
    32 
       
    33 class CX500DistinguishedName;
       
    34 class CX509SubjectKeyIdExt;
       
    35 class CASN1EncSequence;
       
    36 class CASN1EncBase;
       
    37 
       
    38 
       
    39 /**
       
    40  A representation of a RFC2630 (SignerIdentifier) entity.
       
    41  */
       
    42 class CCmsSignerIdentifier : public CBase
       
    43 	{
       
    44 public:
       
    45 
       
    46 	/**
       
    47 	The SignerIdentifier type.
       
    48 	*/
       
    49 	enum TSignerIdentifierType
       
    50 		{
       
    51 		/** The SignerIdentifier type is issuerAndSerialNumber. */
       
    52 		EIssuerAndSerialNumber,
       
    53 		/** The SignerIdentifier type is subjectKeyIdentifier. */
       
    54 		ESubjectKeyIdentifier
       
    55 		};
       
    56 
       
    57 	/**
       
    58 	 * @internalComponent
       
    59 	 * 
       
    60 	 * Creates a CMS SignerIdentifier as defined in RFC2630.
       
    61 	 * @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
       
    62 	 *	this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
       
    63 	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
       
    64 	 *	not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling 
       
    65 	 *	this method, and pop it off the cleanup stack after successful construction.
       
    66 	 *  @return The fully constructed object.
       
    67 	 **/
       
    68 	static CCmsSignerIdentifier* NewL(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
       
    69 	
       
    70 	/**
       
    71 	 * @internalComponent
       
    72 	 *
       
    73 	 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
       
    74 	 * @param aIssuerAndSerialNumber An IssuerAndSerialNumber instance used to construct
       
    75 	 *	this object. Ownership of aIssuerAndSerialNumber is transferred to the newly
       
    76 	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
       
    77 	 *	not transferred. The caller needs to push aIssuerAndSerialNumber onto the cleanup stack before calling 
       
    78 	 *	this method, and pop it off the cleanup stack after successful construction.
       
    79 	 * @return The fully constructed object.
       
    80 	 **/	
       
    81 	static CCmsSignerIdentifier* NewLC(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
       
    82 	
       
    83 	/**
       
    84 	 * @internalComponent
       
    85 	 * 
       
    86 	 * Creates a CMS SignerIdentifier as defined in RFC2630.
       
    87 	 * @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
       
    88 	 *	Ownership of aSubjectKeyIdExt is transferred to the newly
       
    89 	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
       
    90 	 *	not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling 
       
    91 	 *	this method, and pop it off the cleanup stack after successful construction.
       
    92 	 * @return The fully constructed object.
       
    93 	 **/
       
    94 	static CCmsSignerIdentifier* NewL(HBufC8* aSubjectKeyIdExt);
       
    95 	
       
    96 	/**
       
    97 	 * @internalComponent
       
    98 	 * 
       
    99 	 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
       
   100 	 * @param aSubjectKeyIdExt A buffer that contains the subject key identifier.
       
   101 	 *	Ownership of aSubjectKeyIdExt is transferred to the newly
       
   102 	 *	created CCmsSignerIdentifier object. If construction fails, ownership is 
       
   103 	 *	not transferred. The caller needs to push aSubjectKeyIdExt onto the cleanup stack before calling 
       
   104 	 *	this method, and pop it off the cleanup stack after successful construction.
       
   105 	 * @return The fully constructed object
       
   106 	 **/		
       
   107 	static CCmsSignerIdentifier* NewLC(HBufC8* aSubjectKeyIdExt);
       
   108 	
       
   109 	/**
       
   110 	 * @internalComponent
       
   111 	 *
       
   112 	 * Creates a CMS SignerIdentifier as defined in RFC2630.
       
   113 	 * @param aRawData A buffer that contains the encoded CMS signer identifier.
       
   114 	 * @return The fully constructed object.
       
   115 	 **/			
       
   116 	static CCmsSignerIdentifier* NewL(const TDesC8& aRawData);
       
   117 	
       
   118 	/**
       
   119 	 * @internalComponent
       
   120 	 *
       
   121 	 * Creates a CMS SignerIdentifier as defined in RFC2630, and leaves it on the cleanup stack.
       
   122 	 * @param aRawData A buffer that contains the encoded CMS signer identifier.
       
   123 	 * @return The fully constructed object.
       
   124 	 **/				
       
   125 	static CCmsSignerIdentifier* NewLC(const TDesC8& aRawData);
       
   126 	
       
   127 	/**
       
   128 	Destructor
       
   129 	*/
       
   130 	IMPORT_C ~CCmsSignerIdentifier();
       
   131 	
       
   132 	/**
       
   133 	 * @internalComponent
       
   134 	 *
       
   135 	 * Creates the ASN1 sequence of the signer identifier object and leaves it on the cleanup stack.
       
   136 	 * @return ASN1 sequence of this object.
       
   137 	 */	
       
   138 	CASN1EncBase* EncodeASN1DERLC() const;
       
   139 
       
   140 	/**
       
   141 	Returns the issuer and serial name.
       
   142 	@return The CPKCS7IssuerAndSerialNumber reference. NULL if the signer 
       
   143 	identifier type is subjectKeyIdentifier. The signer identifier type can be retrieved
       
   144 	using SignerIdentifierType().
       
   145 	*/		
       
   146 	IMPORT_C const CPKCS7IssuerAndSerialNumber* IssuerAndSerialNumber() const;
       
   147 	
       
   148 	/**
       
   149 	Returns the subject key identifier.
       
   150 	@return The subject key identifier reference. KNullDesC8 if the signer 
       
   151 	identifier type is issuerAndSerialNumber. The signer identifier type can 
       
   152 	be retrieved using SignerIdentifierType().
       
   153 	*/	
       
   154 	IMPORT_C const TDesC8& SubjectKeyIdentifier() const;
       
   155 	
       
   156 	/**
       
   157 	Returns the type of the signer identifier.
       
   158 	@return The type of the signer identifier. See the TSignerIdentifierType enum.
       
   159 	*/		
       
   160 	IMPORT_C TInt SignerIdentifierType() const;
       
   161 	
       
   162 protected:
       
   163 	/**
       
   164 	 * @internalComponent
       
   165 	 * 
       
   166 	 * Default constructor
       
   167 	 **/
       
   168 	CCmsSignerIdentifier();
       
   169 	
       
   170 	/**
       
   171 	 * @internalComponent
       
   172 	 *
       
   173 	 * Constructor for encoding.
       
   174 	 * @param aIssuerAndSerialNumber The issuer and serial number.
       
   175 	 **/
       
   176 	CCmsSignerIdentifier(CPKCS7IssuerAndSerialNumber* aIssuerAndSerialNumber);
       
   177 	
       
   178 	/**
       
   179 	 * @internalComponent
       
   180 	 *
       
   181 	 * Constructor for encoding
       
   182 	 * @param aSubjectKeyIdExt the subject key identifier extension
       
   183 	 **/	
       
   184 	CCmsSignerIdentifier(HBufC8* aSubjectKeyIdExt);
       
   185 	
       
   186 	/**
       
   187 	 * @internalComponent
       
   188 	 *
       
   189 	 * Second phase constructor for encoding
       
   190 	 * @param aRawData the raw data
       
   191 	 **/		
       
   192 	void ConstructL(const TDesC8& aRawData);
       
   193 
       
   194 private:
       
   195 	/**
       
   196 	The type of the signer identifier.
       
   197 	*/
       
   198 	TSignerIdentifierType iSignerIdentifierType;
       
   199 	
       
   200 	/**
       
   201 	The issuer and serial number
       
   202 	*/	
       
   203 	CPKCS7IssuerAndSerialNumber* iIssuerAndSerialNumber;
       
   204 	
       
   205 	/**
       
   206 	The subject key identifier.
       
   207 	*/
       
   208 	HBufC8* iSubjectKeyIdExt;
       
   209 	};	
       
   210 	
       
   211 #endif //CMSSIGNERIDENTIFIER_H