securityanddataprivacytools/securitytools/certapp/encdec/certinfo.h
changeset 0 2c201484c85f
child 8 35751d3474b7
equal deleted inserted replaced
-1:000000000000 0:2c201484c85f
       
     1 #ifndef __CERTINFO_H__
       
     2 #define __CERTINFO_H__
       
     3 /*
       
     4 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     5 * All rights reserved.
       
     6 * This component and the accompanying materials are made available
       
     7 * under the terms of the License "Eclipse Public License v1.0"
       
     8 * which accompanies this distribution, and is available
       
     9 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10 *
       
    11 * Initial Contributors:
       
    12 * Nokia Corporation - initial contribution.
       
    13 *
       
    14 * Contributors:
       
    15 *
       
    16 * Description: 
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 #include "encdec.h"
       
    22 #include "x509utils.h"
       
    23 
       
    24 /**
       
    25  * @file
       
    26  * @internalComponent
       
    27  */
       
    28 /**
       
    29  * The owner of a certificate.
       
    30  * 
       
    31  */
       
    32 enum TCertificateOwnerType
       
    33 	{
       
    34 	ECACertificate,
       
    35 	EUserCertificate,
       
    36 	EPeerCertificate
       
    37 	};
       
    38 
       
    39 const TUint32 KMaxCertLabelLength = 64;
       
    40 typedef TBuf<KMaxCertLabelLength> TCertLabel;
       
    41 void EncodeHuman(REncodeWriteStream& aStream,const TCertLabel &aLabel);
       
    42 void DecodeHuman(RDecodeReadStream& aStream,TCertLabel &aLabel);
       
    43 
       
    44 class CertInfo
       
    45 	{
       
    46 public:
       
    47 	CertInfo(bool aSwiMode);
       
    48 
       
    49 	void Encode(REncodeWriteStream &aWriteStream);
       
    50 	void Decode(RDecodeReadStream &aReadStream);
       
    51 
       
    52 	TUint32 CertSize() const;
       
    53 	void SetCertSize(TUint32 aSize);
       
    54 
       
    55 	const TCertLabel &Label() const;
       
    56 	TCertLabel &Label();
       
    57 
       
    58 	TCertificateFormat CertificateFormat() const;
       
    59 
       
    60 	KeyIdentifierObject &SubjectKeyId();
       
    61 	const KeyIdentifierObject &SubjectKeyId() const;
       
    62 	KeyIdentifierObject &IssuerKeyId();
       
    63 	const KeyIdentifierObject &IssuerKeyId() const;
       
    64 
       
    65 
       
    66 	TUint32 OutputCertificateId() const;
       
    67 	void SetOutputCertificateId(TUint32 aId);
       
    68 	
       
    69 private:
       
    70 	EncDecObject<TUint8> iTmpCombinedDeletableAndFormat;
       
    71 	EncDecEnum<TUint8> iDeletable;
       
    72 	EncDecEnum<TUint8> iFormat; // TCertificateFormat
       
    73 
       
    74 	EncDecObject<TInt> iSize;
       
    75 	EncDecObject<TCertLabel> iLabel;
       
    76 	EncDecObject<TInt> iReadCertificateId; // Read from binary, written to human
       
    77 	EncDecObject<TInt> iWriteCertificateId; // Written to binary
       
    78 	EncDecEnum<TUint8> iCertificateOwnerType; // TCertificateOwnerType
       
    79 	EncDecObject<KeyIdentifierObject> iSubjectKeyId;
       
    80 	EncDecObject<KeyIdentifierObject> iIssuerKeyId;
       
    81 
       
    82 	bool iSwiMode;
       
    83 	};
       
    84 
       
    85 #endif