cryptoservices/certificateandkeymgmt/inc/x520ava.h
changeset 8 35751d3474b7
parent 0 2c201484c85f
child 29 ece3df019add
equal deleted inserted replaced
2:675a964f4eb5 8:35751d3474b7
    15 * Implementation of an attribute type and a value, as defined by the X.520 standard
    15 * Implementation of an attribute type and a value, as defined by the X.520 standard
    16 *
    16 *
    17 */
    17 */
    18 
    18 
    19 
    19 
    20 
       
    21 
       
    22 /**
    20 /**
    23  @file 
    21  @file 
    24  @internalTechnology 
    22  @publishedAll
       
    23  @released
    25 */
    24 */
    26  
    25  
    27 #if !defined(__X520AVA_H__)
    26 #if !defined(__X520AVA_H__)
    28 #define __X520AVA_H__
    27 #define __X520AVA_H__
    29 
    28 
    30 #include <e32base.h>
    29 #include <e32base.h>
    31 #include <e32std.h>
    30 #include <e32std.h>
    32 #include <s32std.h>
    31 #include <s32std.h>
    33 
    32 
    34 /** The attribute type. 
    33 //these are for internal use only
    35 * 
       
    36 * @publishedAll
       
    37 * @released
       
    38 * @since v6.0 */
       
    39 enum TAttributeType
       
    40 	{
       
    41 	/** A common name */
       
    42 	ECommonName,
       
    43 	/** A locality name */
       
    44 	ELocalityName,
       
    45 	/** A state or province name */
       
    46 	EStateOrProvinceName,
       
    47 	/** An organization name */
       
    48 	EOrganizationName,
       
    49 	/** An organizational unit name */
       
    50 	EOrganizationalUnitName,
       
    51 	/** A title */
       
    52 	ETitle,
       
    53 	/** A qualifier */
       
    54 	EDNQualifier,
       
    55 	/** The name of a country */
       
    56 	ECountryName,
       
    57 	/** A given name */
       
    58 	EGivenName,
       
    59 	/** A surname */
       
    60 	ESurname,
       
    61 	/** Initials */
       
    62 	EInitials,
       
    63 	/** A generation qualifier */
       
    64 	EGenerationQualifier,
       
    65 	/** An email address. This is deprecated. */
       
    66 	EPKCS9EmailAddress,
       
    67 	/** A postal code */
       
    68 	EPostalCode,
       
    69 	/** A serial number */
       
    70 	ESerialNumber,
       
    71 	/** An RFC 2247 domain component.
       
    72 	* 
       
    73 	* A domain name is made up of an ordered set of components.*/
       
    74 	ERFC2247DomainComponent,
       
    75 	/** RFC 2256 street component.
       
    76 	* 
       
    77 	* A street */
       
    78 	ERFC2256Street,
       
    79 	/** A name of the subject of a certificate as an unstructured ASCII string */
       
    80 	EPKCS9UnstructuredName
       
    81 	};
       
    82 
       
    83 //these are the only attribute types we handle at present
    34 //these are the only attribute types we handle at present
    84 _LIT(KX520CountryName,"2.5.4.6");
    35 _LIT(KX520CountryName,"2.5.4.6");
    85 _LIT(KX520OrganizationName,"2.5.4.10");
    36 _LIT(KX520OrganizationName,"2.5.4.10");
    86 _LIT(KX520OrganizationalUnitName,"2.5.4.11");
    37 _LIT(KX520OrganizationalUnitName,"2.5.4.11");
    87 _LIT(KX520LocalityName,"2.5.4.7");
    38 _LIT(KX520LocalityName,"2.5.4.7");
    92 _LIT(KX520Surname,"2.5.4.4");
    43 _LIT(KX520Surname,"2.5.4.4");
    93 _LIT(KX520Initials,"2.5.4.43");
    44 _LIT(KX520Initials,"2.5.4.43");
    94 _LIT(KX520GenerationQualifier,"2.5.4.44");
    45 _LIT(KX520GenerationQualifier,"2.5.4.44");
    95 _LIT(KX520DNQualifier,"2.5.4.46");
    46 _LIT(KX520DNQualifier,"2.5.4.46");
    96 _LIT(KX520SerialNumber,"2.5.4.5");
    47 _LIT(KX520SerialNumber,"2.5.4.5");
       
    48 
       
    49 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    50 //more attribute types we handle at present
    97 _LIT(KX520PostalCode,"2.5.4.17");
    51 _LIT(KX520PostalCode,"2.5.4.17");
    98 _LIT(KRFC2247DomainComponent, "0.9.2342.19200300.100.1.25");
    52 _LIT(KRFC2247DomainComponent, "0.9.2342.19200300.100.1.25");
    99 _LIT(KRFC2256Street,"2.5.4.9");
    53 _LIT(KRFC2256Street,"2.5.4.9");
   100 _LIT(KPKCS9UnstructuredName, "1.2.840.113549.1.9.2");
    54 _LIT(KPKCS9UnstructuredName, "1.2.840.113549.1.9.2");
   101 
    55 
   138 * Each component of the domain name is a short string. */
    92 * Each component of the domain name is a short string. */
   139 const TInt KRFC2247MaxDomainComponentLength = 128;
    93 const TInt KRFC2247MaxDomainComponentLength = 128;
   140 /** The maximum length allowed a for street. */
    94 /** The maximum length allowed a for street. */
   141 const TInt KRFC2256StreetLength = 128;
    95 const TInt KRFC2256StreetLength = 128;
   142 
    96 
       
    97 #endif
       
    98 
       
    99 
       
   100 /** The attribute type. 
       
   101 * 
       
   102 * @since v6.0 */
       
   103 enum TAttributeType
       
   104 	{
       
   105 	/** A common name */
       
   106 	ECommonName,
       
   107 	/** A locality name */
       
   108 	ELocalityName,
       
   109 	/** A state or province name */
       
   110 	EStateOrProvinceName,
       
   111 	/** An organization name */
       
   112 	EOrganizationName,
       
   113 	/** An organizational unit name */
       
   114 	EOrganizationalUnitName,
       
   115 	/** A title */
       
   116 	ETitle,
       
   117 	/** A qualifier */
       
   118 	EDNQualifier,
       
   119 	/** The name of a country */
       
   120 	ECountryName,
       
   121 	/** A given name */
       
   122 	EGivenName,
       
   123 	/** A surname */
       
   124 	ESurname,
       
   125 	/** Initials */
       
   126 	EInitials,
       
   127 	/** A generation qualifier */
       
   128 	EGenerationQualifier,
       
   129 	/** An email address. This is deprecated. */
       
   130 	EPKCS9EmailAddress,
       
   131 	/** A postal code */
       
   132 	EPostalCode,
       
   133 	/** A serial number */
       
   134 	ESerialNumber,
       
   135 	/** An RFC 2247 domain component.
       
   136 	* 
       
   137 	* A domain name is made up of an ordered set of components.*/
       
   138 	ERFC2247DomainComponent,
       
   139 	/** RFC 2256 street component.
       
   140 	* 
       
   141 	* A street */
       
   142 	ERFC2256Street,
       
   143 	/** A name of the subject of a certificate as an unstructured ASCII string */
       
   144 	EPKCS9UnstructuredName
       
   145 	};
       
   146 
       
   147 
   143 class CASN1EncSequence;
   148 class CASN1EncSequence;
   144 
   149 
   145 class CX520AttributeTypeAndValue : public CBase
   150 class CX520AttributeTypeAndValue : public CBase
   146 /** Contains an attribute type and a value, as defined by the X.520 standard.
   151 /** Contains an attribute type and a value, as defined by the X.520 standard.
   147 * 
   152 * 
   148 * A Distinguished Name object, as defined by the X.500 standard, consists of 
   153 * A Distinguished Name object, as defined by the X.500 standard, consists of 
   149 * a sequence of these objects. 
   154 * a sequence of these objects. 
   150 * 
   155 * 
   151 * @publishedAll
       
   152 * @released
       
   153 * @since v6.0 
   156 * @since v6.0 
   154 */
   157 */
   155 // Attribute and value pair class. Attribute and value pairs 
   158 // Attribute and value pair class. Attribute and value pairs 
   156 //	are used in distinguished names and certificate attributes. 
   159 //	are used in distinguished names and certificate attributes. 
   157 //	Stores data in ASN.1 format internally.
   160 //	Stores data in ASN.1 format internally.
   308 	CX520AttributeTypeAndValue(); ///< Protected default constructor
   311 	CX520AttributeTypeAndValue(); ///< Protected default constructor
   309 	void ConstructL(const CX520AttributeTypeAndValue& aPair);
   312 	void ConstructL(const CX520AttributeTypeAndValue& aPair);
   310 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   313 	void ConstructL(const TDesC8& aBinaryData, TInt& aPos);
   311 	void ConstructL(TAttributeType aType, const TDesC8& aValue);
   314 	void ConstructL(TAttributeType aType, const TDesC8& aValue);
   312 	/**
   315 	/**
   313 	 * This method finds out if case-insensitive comparisons must be done or not.
   316      * This method finds out if case-insensitive comparisons must be done or not.
   314 	 * Email Address is the exceptional case of 'IA5String' value type for which comparisons must be
   317 	 * Email Address is the exceptional case of 'IA5String' value type for which comparisons must be
   315 	 * done case-insensitivly.
   318 	 * done case-insensitivly.
   316 	 * 
   319 	 * 
   317 	 * @param aSource	contains the encoded value of the attribute type.
   320 	 * @param aSource	contains the encoded value of the attribute type.
   318 	 * @return			ETrue, if case-insensitive comparisons are to be done. 
   321  	 * @return	    	ETrue, if case-insensitive comparisons are to be done. 
   319 	 * 						   This is only when value type is a Printable String OR if attribute type is an Email Address. 
   322 	 * 		        	This is only when value type is a Printable String OR if attribute type is an Email Address. 
   320 	 * 					EFalse, otherwise.
   323 	 * 		        	EFalse, otherwise.
   321 	 */ 
   324  	 */ 
   322 	TBool IsCaseInSensitive(const TDesC8& aSource) const;
   325  	TBool IsCaseInSensitiveL(const TDesC8& aSource) const;
   323 	HBufC* iType; ///< The encoded type
   326 	HBufC* iType; ///< The encoded type
   324 	HBufC8* iValue; ///< The encoded value
   327 	HBufC8* iValue; ///< The encoded value
   325 	};
   328 	};
   326 
   329 
   327 #endif
   330 #endif