os/security/cryptoservices/certificateandkeymgmt/inc/pkcs12attribute.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 2005-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 __PKCS12ATTRIBUTE_H__
    26 #define __PKCS12ATTRIBUTE_H__
    27 
    28 #include <asn1dec.h>
    29 
    30 namespace PKCS12
    31 {
    32 /**
    33  This class decodes the bagAttributes present in the SafeBag.
    34  It has methods to get the AttributeId and the AttributeValue.
    35  */
    36 class CDecPkcs12Attribute : public CBase
    37 	{
    38 public:
    39     /**
    40 	 Creates a new PKCS#12 attribute object.
    41 	
    42 	 PKCS#12AttrSet ATTRIBUTE ::= {
    43 	 	friendlyName |
    44 	 	localKeyId,
    45 	 	... -- Other attributes are allowed
    46 	 	}  
    47 	 	
    48 	 @param  aBagAttributes Contains a PKCS#12 attribute set.
    49 	 @return A pointer to the newly allocated object.
    50 	 @leave  if the bag attribute set is not a sequence or class 
    51 	 		 tag name is not Universal.
    52 	 */
    53 	IMPORT_C static CDecPkcs12Attribute* NewL(const TDesC8& aBagAttributes);
    54 	
    55 	/**
    56 	 Returns the ObjectIdentifier indicating the attribute type:
    57 	 - OID ---- 1.2.840.113549.1.9.20 friendlyName
    58      - OID ---- 1.2.840.113549.1.9.21 localKeyId 
    59 	 @return An object identifier indicating the attribute type.
    60 	 */
    61 	IMPORT_C const TDesC& AttributeId() const;
    62 	
    63 	/**
    64 	 Returns the DER encoded attribute values present in the Safe Bag.
    65 	 @return The ASN1Set of attribute values
    66 	 */
    67 	IMPORT_C const RPointerArray<TDesC8>& AttributeValue() const;
    68 			
    69 	/**
    70 	 Destructor.
    71 	 */
    72 	virtual ~CDecPkcs12Attribute();
    73 	
    74 private:
    75 	/**
    76      This decodes the entire BagAttributes structure
    77      @param aBagAttributes Contains a PKCS#12 attribute set.
    78      @leave if the bag attribute set is not a sequence or class 
    79 	 		 tag name is not Universal.
    80      */
    81 	void ConstructL(const TDesC8& aBagAttributes);
    82 		  
    83 	/**
    84 	 Construtor.
    85 	 */
    86 	 CDecPkcs12Attribute();
    87 		  
    88 	/**
    89 	 Copy Constructor.
    90 	 @param aDecPkcs12Atrribute A CDecPkcs12Attribute object.
    91 	 */
    92 	 CDecPkcs12Attribute(const CDecPkcs12Attribute& aDecPkcs12Atrribute);
    93 	 
    94 	 /**
    95 	  Assignment operator.
    96 	  @param aDecPkcs12Atrribute A CDecPkcs12Attribute object.
    97 	  @return A reference to CDecPkcs12Attribute class.
    98 	  */
    99 	 CDecPkcs12Attribute& operator=(const CDecPkcs12Attribute& aDecPkcs12Atrribute);
   100 	 
   101 private:
   102 	/** Contains the object identifier indicating the attribute type */
   103 	HBufC* iAttributeId;
   104 	
   105 	/** Contains the attribute value which is an DER encoded value */
   106 	RPointerArray<TDesC8> iAttributeValue;
   107 	};
   108 } // namespace PKCS12
   109 #endif // __PKCS12ATTRIBUTE_H__
   110 
   111