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