1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/ssl/libcrypto/inc/include/certretriever/certretriever.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,123 @@
1.4 +/*
1.5 +Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.6 +
1.7 +Redistribution and use in source and binary forms, with or without
1.8 +modification, are permitted provided that the following conditions are met:
1.9 +
1.10 +* Redistributions of source code must retain the above copyright notice, this
1.11 + list of conditions and the following disclaimer.
1.12 +* Redistributions in binary form must reproduce the above copyright notice,
1.13 + this list of conditions and the following disclaimer in the documentation
1.14 + and/or other materials provided with the distribution.
1.15 +* Neither the name of Nokia Corporation nor the names of its contributors
1.16 + may be used to endorse or promote products derived from this software
1.17 + without specific prior written permission.
1.18 +
1.19 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
1.20 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1.21 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1.22 +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
1.23 +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1.24 +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1.25 +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1.26 +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
1.27 +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1.28 +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1.29 +
1.30 +Description:
1.31 +*/
1.32 +
1.33 +
1.34 +#ifndef CERT_RETRIEVER_H
1.35 +#define CERT_RETRIEVER_H
1.36 +
1.37 +#ifdef __cplusplus
1.38 +
1.39 +#include <unifiedcertstore.h>
1.40 +#include <mctwritablecertstore.h>
1.41 +#include <x509cert.h>
1.42 +#include <signed.h>
1.43 +#include <openssl/x509.h>
1.44 +
1.45 +#endif
1.46 +
1.47 +#define ISSUER_NAME 0
1.48 +#define SUBJECT_NAME 1
1.49 +
1.50 +// CONSTANT
1.51 +const TInt KCertMaxBuffer = 32;
1.52 +const TInt KMaxNameLength = 256;
1.53 +const TInt KMaxCertLength = 5120;
1.54 +
1.55 +#ifdef __cplusplus
1.56 +extern "C"
1.57 +{
1.58 +#endif
1.59 +int X509_add_symbian_certsL(X509_STORE * store);
1.60 +#ifdef __cplusplus
1.61 +}
1.62 +#endif
1.63 +
1.64 +
1.65 +#ifdef __cplusplus
1.66 +
1.67 +NONSHARABLE_CLASS (CCertRetriever) : public CActive
1.68 + {
1.69 +public:
1.70 + static CCertRetriever* NewLC(
1.71 + X509_STORE* aStore,
1.72 + TRequestStatus& aStatus,
1.73 + const CActiveScheduler* aActiveScheduler);
1.74 + static CCertRetriever* NewL(
1.75 + X509_STORE* aStore,
1.76 + TRequestStatus& aStatus,
1.77 + const CActiveScheduler* aActiveScheduler);
1.78 + ~CCertRetriever();
1.79 + void RunL();
1.80 + void DoCancel();
1.81 + TInt RunError(TInt aError);
1.82 + void RetriveCertificateL();
1.83 + CActiveSchedulerWait* activeSchedulerwait; //For nested wait loop;
1.84 + TBool OwnScheduler;
1.85 +
1.86 +private:
1.87 + CCertRetriever(X509_STORE* aStore,
1.88 + TRequestStatus& aStatus,
1.89 + const CActiveScheduler* aActiveScheduler);
1.90 + void ConstructL();
1.91 +
1.92 + void OpenUnifiedCertStoreL();
1.93 + void ListCertsL();
1.94 + void AppendCertsL();
1.95 + void ProcessCertsL();
1.96 +
1.97 +private:
1.98 + X509_STORE* iStore;
1.99 + TRequestStatus& iFinStatus;
1.100 + const CActiveScheduler* iActiveScheduler;
1.101 +
1.102 + RFs iFs;
1.103 + CUnifiedCertStore * iCertStore;
1.104 + CCertAttributeFilter * iCertFilter;
1.105 + RMPointerArray< CCTCertInfo > iCerts;
1.106 +
1.107 + enum TStateLists
1.108 + {
1.109 + EInitializeCertStore,
1.110 + EListCerts,
1.111 + EAppendCerts,
1.112 + ENoCerts,
1.113 + EDone
1.114 + };
1.115 +
1.116 + TStateLists iState;
1.117 +
1.118 + TInt iCertCount;
1.119 + TPtr8 iCertPtr ;
1.120 + HBufC8 *iBuf;
1.121 + };
1.122 +
1.123 +
1.124 +#endif
1.125 +
1.126 +#endif //CERT_RETRIEVER_H