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