sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: sl@0: #ifndef __PKCS7_CONTENT_INFO_V2_H__ sl@0: #define __PKCS7_CONTENT_INFO_V2_H__ sl@0: sl@0: #include sl@0: sl@0: /** pkcs7-1 data */ sl@0: _LIT(KPkcs7DataOID, "1.2.840.113549.1.7.1"); sl@0: sl@0: /** pkcs7-2 SignedData */ sl@0: _LIT(KPkcs7SignedDataOID, "1.2.840.113549.1.7.2"); sl@0: sl@0: /** pkcs7-3 EnvelopedData */ sl@0: _LIT(KPkcs7EnvelopedDataOID, "1.2.840.113549.1.7.3"); sl@0: sl@0: /** pkcs7-4 SignedAndEnvelopedData */ sl@0: _LIT(KPkcs7SignedAndEnvelopedDataOID, "1.2.840.113549.1.7.4"); sl@0: sl@0: /** pkcs7-5 DigestedData */ sl@0: _LIT(KPkcs7DigestedDataOID, "1.2.840.113549.1.7.5"); sl@0: sl@0: /** pkcs7-6 EncryptedData */ sl@0: _LIT(KPkcs7EncryptedDataOID, "1.2.840.113549.1.7.6"); sl@0: sl@0: /** The numeric value of last element in the PKCS7 Data OID */ sl@0: const TInt KPkcs7Data = 1; sl@0: sl@0: /** The numeric value of last element in the PKCS7 Signed OID */ sl@0: const TInt KPkcs7SignedData = 2; sl@0: sl@0: /** sl@0: The RFC2315 ContentInfo entity sl@0: This class provides details about the Content Type in the Content Info, sl@0: Provides access to the Content Data when the Content Type is Data and sl@0: provides access to the Entire ContentInfo Sequence. sl@0: */ sl@0: class CPKCS7ContentInfo : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: Identifies the type of Content Type present in the PKCS7 ContentInfo Structure. sl@0: */ sl@0: enum TContentInfoType sl@0: { sl@0: /** The numeric value of last element in the PKCS7 ContentType Data OID */ sl@0: EContentTypeData = 1, sl@0: /** The numeric value of last element in the PKCS7 ContentType SignedData OID */ sl@0: EContentTypeSignedData, sl@0: /** The numeric value of last element in the PKCS7 ContentType EnvelopedData OID */ sl@0: EContentTypeEnvelopedData, sl@0: /** The numeric value of last element in the PKCS7 ContentType SignedAndEnvelopedData OID */ sl@0: EContentTypeSignedAndEnvelopedData, sl@0: /** The numeric value of last element in the PKCS7 ContentType DigestedData OID */ sl@0: EContentTypeDigestedData, sl@0: /** The numeric value of last element in the PKCS7 ContentType EncryptedData OID */ sl@0: EContentTypeEncryptedData sl@0: }; sl@0: /** sl@0: Creates a new PKCS#7 ContentInfo object. sl@0: @param aRawData contains a PKCS#7 ContentInfo Structure sl@0: @return A pointer to the newly allocated object. sl@0: @leave KErrNotSupported if the OID value is otherthan enum TContentInfoType. sl@0: @leave KErrArgument if the data is not PKCS7 contentInfo structure. sl@0: @see TContentInfoType sl@0: */ sl@0: IMPORT_C static CPKCS7ContentInfo* NewL(const TDesC8& aRawData); sl@0: sl@0: /** sl@0: Destructor. sl@0: */ sl@0: virtual ~CPKCS7ContentInfo(); sl@0: sl@0: public: sl@0: /** sl@0: Provides the information about the ContentType in the sl@0: ContentInfo Sequence. sl@0: It returns the last number in the ObjectIdentifier sl@0: @return The ContentType. This is sl@0: 1 for Data sl@0: 2 for SignedData sl@0: 3 for EnvelopedData sl@0: 4 for SignedAndEnvelopedData sl@0: 5 for DigestedData sl@0: 6 for EncryptedData sl@0: */ sl@0: IMPORT_C TContentInfoType ContentType() const; sl@0: sl@0: /** sl@0: Provides access to the Content Data present in PKCS#7 ContentInfo sl@0: ContentData present in PKCS#7 ContentInfo is OPTIONAL sl@0: The client has to check for data length 0 in case there is no ContentData. sl@0: @return The ContentData sl@0: */ sl@0: IMPORT_C const TPtrC8 ContentData() const; sl@0: sl@0: private: sl@0: /** sl@0: Constructor. sl@0: */ sl@0: CPKCS7ContentInfo(void); sl@0: sl@0: /** sl@0: Copy Constructor. sl@0: @param aContentinfo A CPKCS7ContentInfo object. sl@0: */ sl@0: CPKCS7ContentInfo(const CPKCS7ContentInfo& aContentInfo); sl@0: sl@0: /** sl@0: Assignment operator. sl@0: @param aContentinfo A CPKCS7ContentInfo object. sl@0: @return A reference to CPKCS7ContentInfo class. sl@0: */ sl@0: CPKCS7ContentInfo& operator=(const CPKCS7ContentInfo& aContentInfo); sl@0: sl@0: /** sl@0: Decodes the PKCS#7 ContentInfo object. sl@0: @param aRawData contains a PKCS#7 ContentInfo Structure. sl@0: @leave KErrNotSupported if the OID val is otherthan 1 - 6 sl@0: i,e the last part of the OID. sl@0: @leave KErrArgument if the data is not PKCS7 contentInfo structure. sl@0: @ see TASN1DecObjectIdentifier, sl@0: */ sl@0: void ConstructL(const TDesC8& aRawData); sl@0: sl@0: private: sl@0: /** sl@0: Indicates the type of content. Here it is the last Character sl@0: in the OID which identifies the Content Type. sl@0: */ sl@0: TContentInfoType iContentType; sl@0: sl@0: /** The ContentData present in PKCS7 ContentInfo*/ sl@0: TPtrC8 iContentData; sl@0: }; sl@0: sl@0: #endif // __PKCS7_CONTENT_INFO_V2_H__ sl@0: sl@0: