os/security/cryptoservices/certificateandkeymgmt/inc/pkcs12attribute.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/cryptoservices/certificateandkeymgmt/inc/pkcs12attribute.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,111 @@
     1.4 +/*
     1.5 +* Copyright (c) 2005-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 __PKCS12ATTRIBUTE_H__
    1.29 +#define __PKCS12ATTRIBUTE_H__
    1.30 +
    1.31 +#include <asn1dec.h>
    1.32 +
    1.33 +namespace PKCS12
    1.34 +{
    1.35 +/**
    1.36 + This class decodes the bagAttributes present in the SafeBag.
    1.37 + It has methods to get the AttributeId and the AttributeValue.
    1.38 + */
    1.39 +class CDecPkcs12Attribute : public CBase
    1.40 +	{
    1.41 +public:
    1.42 +    /**
    1.43 +	 Creates a new PKCS#12 attribute object.
    1.44 +	
    1.45 +	 PKCS#12AttrSet ATTRIBUTE ::= {
    1.46 +	 	friendlyName |
    1.47 +	 	localKeyId,
    1.48 +	 	... -- Other attributes are allowed
    1.49 +	 	}  
    1.50 +	 	
    1.51 +	 @param  aBagAttributes Contains a PKCS#12 attribute set.
    1.52 +	 @return A pointer to the newly allocated object.
    1.53 +	 @leave  if the bag attribute set is not a sequence or class 
    1.54 +	 		 tag name is not Universal.
    1.55 +	 */
    1.56 +	IMPORT_C static CDecPkcs12Attribute* NewL(const TDesC8& aBagAttributes);
    1.57 +	
    1.58 +	/**
    1.59 +	 Returns the ObjectIdentifier indicating the attribute type:
    1.60 +	 - OID ---- 1.2.840.113549.1.9.20 friendlyName
    1.61 +     - OID ---- 1.2.840.113549.1.9.21 localKeyId 
    1.62 +	 @return An object identifier indicating the attribute type.
    1.63 +	 */
    1.64 +	IMPORT_C const TDesC& AttributeId() const;
    1.65 +	
    1.66 +	/**
    1.67 +	 Returns the DER encoded attribute values present in the Safe Bag.
    1.68 +	 @return The ASN1Set of attribute values
    1.69 +	 */
    1.70 +	IMPORT_C const RPointerArray<TDesC8>& AttributeValue() const;
    1.71 +			
    1.72 +	/**
    1.73 +	 Destructor.
    1.74 +	 */
    1.75 +	virtual ~CDecPkcs12Attribute();
    1.76 +	
    1.77 +private:
    1.78 +	/**
    1.79 +     This decodes the entire BagAttributes structure
    1.80 +     @param aBagAttributes Contains a PKCS#12 attribute set.
    1.81 +     @leave if the bag attribute set is not a sequence or class 
    1.82 +	 		 tag name is not Universal.
    1.83 +     */
    1.84 +	void ConstructL(const TDesC8& aBagAttributes);
    1.85 +		  
    1.86 +	/**
    1.87 +	 Construtor.
    1.88 +	 */
    1.89 +	 CDecPkcs12Attribute();
    1.90 +		  
    1.91 +	/**
    1.92 +	 Copy Constructor.
    1.93 +	 @param aDecPkcs12Atrribute A CDecPkcs12Attribute object.
    1.94 +	 */
    1.95 +	 CDecPkcs12Attribute(const CDecPkcs12Attribute& aDecPkcs12Atrribute);
    1.96 +	 
    1.97 +	 /**
    1.98 +	  Assignment operator.
    1.99 +	  @param aDecPkcs12Atrribute A CDecPkcs12Attribute object.
   1.100 +	  @return A reference to CDecPkcs12Attribute class.
   1.101 +	  */
   1.102 +	 CDecPkcs12Attribute& operator=(const CDecPkcs12Attribute& aDecPkcs12Atrribute);
   1.103 +	 
   1.104 +private:
   1.105 +	/** Contains the object identifier indicating the attribute type */
   1.106 +	HBufC* iAttributeId;
   1.107 +	
   1.108 +	/** Contains the attribute value which is an DER encoded value */
   1.109 +	RPointerArray<TDesC8> iAttributeValue;
   1.110 +	};
   1.111 +} // namespace PKCS12
   1.112 +#endif // __PKCS12ATTRIBUTE_H__
   1.113 +
   1.114 +