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