os/security/cryptoservices/certificateandkeymgmt/inc/pkcs12attribute.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.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file
sl@0
    21
 @publishedPartner
sl@0
    22
 @released
sl@0
    23
*/
sl@0
    24
sl@0
    25
#ifndef __PKCS12ATTRIBUTE_H__
sl@0
    26
#define __PKCS12ATTRIBUTE_H__
sl@0
    27
sl@0
    28
#include <asn1dec.h>
sl@0
    29
sl@0
    30
namespace PKCS12
sl@0
    31
{
sl@0
    32
/**
sl@0
    33
 This class decodes the bagAttributes present in the SafeBag.
sl@0
    34
 It has methods to get the AttributeId and the AttributeValue.
sl@0
    35
 */
sl@0
    36
class CDecPkcs12Attribute : public CBase
sl@0
    37
	{
sl@0
    38
public:
sl@0
    39
    /**
sl@0
    40
	 Creates a new PKCS#12 attribute object.
sl@0
    41
	
sl@0
    42
	 PKCS#12AttrSet ATTRIBUTE ::= {
sl@0
    43
	 	friendlyName |
sl@0
    44
	 	localKeyId,
sl@0
    45
	 	... -- Other attributes are allowed
sl@0
    46
	 	}  
sl@0
    47
	 	
sl@0
    48
	 @param  aBagAttributes Contains a PKCS#12 attribute set.
sl@0
    49
	 @return A pointer to the newly allocated object.
sl@0
    50
	 @leave  if the bag attribute set is not a sequence or class 
sl@0
    51
	 		 tag name is not Universal.
sl@0
    52
	 */
sl@0
    53
	IMPORT_C static CDecPkcs12Attribute* NewL(const TDesC8& aBagAttributes);
sl@0
    54
	
sl@0
    55
	/**
sl@0
    56
	 Returns the ObjectIdentifier indicating the attribute type:
sl@0
    57
	 - OID ---- 1.2.840.113549.1.9.20 friendlyName
sl@0
    58
     - OID ---- 1.2.840.113549.1.9.21 localKeyId 
sl@0
    59
	 @return An object identifier indicating the attribute type.
sl@0
    60
	 */
sl@0
    61
	IMPORT_C const TDesC& AttributeId() const;
sl@0
    62
	
sl@0
    63
	/**
sl@0
    64
	 Returns the DER encoded attribute values present in the Safe Bag.
sl@0
    65
	 @return The ASN1Set of attribute values
sl@0
    66
	 */
sl@0
    67
	IMPORT_C const RPointerArray<TDesC8>& AttributeValue() const;
sl@0
    68
			
sl@0
    69
	/**
sl@0
    70
	 Destructor.
sl@0
    71
	 */
sl@0
    72
	virtual ~CDecPkcs12Attribute();
sl@0
    73
	
sl@0
    74
private:
sl@0
    75
	/**
sl@0
    76
     This decodes the entire BagAttributes structure
sl@0
    77
     @param aBagAttributes Contains a PKCS#12 attribute set.
sl@0
    78
     @leave if the bag attribute set is not a sequence or class 
sl@0
    79
	 		 tag name is not Universal.
sl@0
    80
     */
sl@0
    81
	void ConstructL(const TDesC8& aBagAttributes);
sl@0
    82
		  
sl@0
    83
	/**
sl@0
    84
	 Construtor.
sl@0
    85
	 */
sl@0
    86
	 CDecPkcs12Attribute();
sl@0
    87
		  
sl@0
    88
	/**
sl@0
    89
	 Copy Constructor.
sl@0
    90
	 @param aDecPkcs12Atrribute A CDecPkcs12Attribute object.
sl@0
    91
	 */
sl@0
    92
	 CDecPkcs12Attribute(const CDecPkcs12Attribute& aDecPkcs12Atrribute);
sl@0
    93
	 
sl@0
    94
	 /**
sl@0
    95
	  Assignment operator.
sl@0
    96
	  @param aDecPkcs12Atrribute A CDecPkcs12Attribute object.
sl@0
    97
	  @return A reference to CDecPkcs12Attribute class.
sl@0
    98
	  */
sl@0
    99
	 CDecPkcs12Attribute& operator=(const CDecPkcs12Attribute& aDecPkcs12Atrribute);
sl@0
   100
	 
sl@0
   101
private:
sl@0
   102
	/** Contains the object identifier indicating the attribute type */
sl@0
   103
	HBufC* iAttributeId;
sl@0
   104
	
sl@0
   105
	/** Contains the attribute value which is an DER encoded value */
sl@0
   106
	RPointerArray<TDesC8> iAttributeValue;
sl@0
   107
	};
sl@0
   108
} // namespace PKCS12
sl@0
   109
#endif // __PKCS12ATTRIBUTE_H__
sl@0
   110
sl@0
   111