1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/securityanddataprivacytools/securitytools/certapp/encdec/certinfo.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,86 @@
1.4 +#ifndef __CERTINFO_H__
1.5 +#define __CERTINFO_H__/*
1.6 +* Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
1.7 +* All rights reserved.
1.8 +* This component and the accompanying materials are made available
1.9 +* under the terms of the License "Eclipse Public License v1.0"
1.10 +* which accompanies this distribution, and is available
1.11 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.12 +*
1.13 +* Initial Contributors:
1.14 +* Nokia Corporation - initial contribution.
1.15 +*
1.16 +* Contributors:
1.17 +*
1.18 +* Description:
1.19 +*
1.20 +*/
1.21 +
1.22 +
1.23 +#include "encdec.h"
1.24 +#include "x509utils.h"
1.25 +
1.26 +/**
1.27 + * @file
1.28 + * @internalComponent
1.29 + */
1.30 +/**
1.31 + * The owner of a certificate.
1.32 + *
1.33 + */
1.34 +enum TCertificateOwnerType
1.35 + {
1.36 + ECACertificate,
1.37 + EUserCertificate,
1.38 + EPeerCertificate
1.39 + };
1.40 +
1.41 +const TUint32 KMaxCertLabelLength = 64;
1.42 +typedef TBuf<KMaxCertLabelLength> TCertLabel;
1.43 +void EncodeHuman(REncodeWriteStream& aStream,const TCertLabel &aLabel);
1.44 +void DecodeHuman(RDecodeReadStream& aStream,TCertLabel &aLabel);
1.45 +
1.46 +class CertInfo
1.47 + {
1.48 +public:
1.49 + CertInfo(bool aSwiMode);
1.50 +
1.51 + void Encode(REncodeWriteStream &aWriteStream);
1.52 + void Decode(RDecodeReadStream &aReadStream);
1.53 +
1.54 + TUint32 CertSize() const;
1.55 + void SetCertSize(TUint32 aSize);
1.56 +
1.57 + const TCertLabel &Label() const;
1.58 + TCertLabel &Label();
1.59 +
1.60 + TCertificateFormat CertificateFormat() const;
1.61 +
1.62 + KeyIdentifierObject &SubjectKeyId();
1.63 + const KeyIdentifierObject &SubjectKeyId() const;
1.64 + KeyIdentifierObject &IssuerKeyId();
1.65 + const KeyIdentifierObject &IssuerKeyId() const;
1.66 +
1.67 +
1.68 + TUint32 OutputCertificateId() const;
1.69 + void SetOutputCertificateId(TUint32 aId);
1.70 +
1.71 + TCertificateOwnerType CertificateOwnerType() const;
1.72 +
1.73 +private:
1.74 + EncDecObject<TUint8> iTmpCombinedDeletableAndFormat;
1.75 + EncDecEnum<TUint8> iDeletable;
1.76 + EncDecEnum<TUint8> iFormat; // TCertificateFormat
1.77 +
1.78 + EncDecObject<TInt> iSize;
1.79 + EncDecObject<TCertLabel> iLabel;
1.80 + EncDecObject<TInt> iReadCertificateId; // Read from binary, written to human
1.81 + EncDecObject<TInt> iWriteCertificateId; // Written to binary
1.82 + EncDecEnum<TUint8> iCertificateOwnerType; // TCertificateOwnerType
1.83 + EncDecObject<KeyIdentifierObject> iSubjectKeyId;
1.84 + EncDecObject<KeyIdentifierObject> iIssuerKeyId;
1.85 +
1.86 + bool iSwiMode;
1.87 + };
1.88 +
1.89 +#endif