secureswitools/swianalysistoolkit/source/chainvalidityandinstallfilestatustools/dumpchainvaliditytool/dumpchainvalidity.cpp
equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "dumpchainvaliditytool.h" |
|
20 #include "options.h" |
|
21 #include "swicertstore.h" |
|
22 #include "siscertificatechain.h" |
|
23 #ifdef _MSC_VER |
|
24 #include <new> |
|
25 #include <new.h> |
|
26 #endif /* _MSC_VER */ |
|
27 using namespace std; |
|
28 |
|
29 #ifdef _MSC_VER |
|
30 // House-keeping to allow ::new to throw rather than return NULL in MSVC++ |
|
31 int throwingHandler(size_t) |
|
32 { |
|
33 throw std::bad_alloc(); |
|
34 return 0; |
|
35 } |
|
36 #endif /* _MSC_VER */ |
|
37 |
|
38 //entry point |
|
39 int main(int argc,char *argv[]) |
|
40 { |
|
41 #ifdef _MSC_VER |
|
42 _set_new_handler (throwingHandler); // Make ::new throw rather than return NULL |
|
43 #endif /* _MSC_VER */ |
|
44 |
|
45 if(argc < 2) |
|
46 { |
|
47 Options::DisplayUsage(); |
|
48 return 0; |
|
49 } |
|
50 |
|
51 OpenSSL_add_all_algorithms (); |
|
52 OpenSSL_add_all_ciphers (); |
|
53 OpenSSL_add_all_digests (); |
|
54 |
|
55 DumpChainValidityTool* Tool=0; |
|
56 Options* options=0; |
|
57 |
|
58 try |
|
59 { |
|
60 Tool = new DumpChainValidityTool(); |
|
61 options = new Options (argc,argv); |
|
62 Tool->Run(*options); |
|
63 } |
|
64 |
|
65 catch (Exceptions& aErr) |
|
66 { |
|
67 Options::DisplayError (aErr); |
|
68 delete options; |
|
69 delete Tool; |
|
70 return aErr; |
|
71 } |
|
72 |
|
73 catch (bad_alloc&) |
|
74 { |
|
75 cout << "Error Allocating Memory " << endl ; |
|
76 } |
|
77 |
|
78 delete options; |
|
79 delete Tool; |
|
80 return 0; |
|
81 } |