OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This utility can dump the contents of CRL set, optionally augmented with a | 5 // This utility can dump the contents of CRL set, optionally augmented with a |
6 // delta CRL set. | 6 // delta CRL set. |
7 | 7 |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <stdio.h> | 9 #include <stdio.h> |
10 #include <stdlib.h> | 10 #include <stdlib.h> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 return 1; | 46 return 1; |
47 } | 47 } |
48 | 48 |
49 scoped_refptr<net::CRLSet> crl_set, final_crl_set; | 49 scoped_refptr<net::CRLSet> crl_set, final_crl_set; |
50 if (!net::CRLSetStorage::Parse(crl_set_bytes, &crl_set)) { | 50 if (!net::CRLSetStorage::Parse(crl_set_bytes, &crl_set)) { |
51 fprintf(stderr, "Failed to parse CRLSet\n"); | 51 fprintf(stderr, "Failed to parse CRLSet\n"); |
52 return 1; | 52 return 1; |
53 } | 53 } |
54 | 54 |
55 if (!delta_bytes.empty()) { | 55 if (!delta_bytes.empty()) { |
56 if (!net::CRLSetStorage::ApplyDelta(crl_set, delta_bytes, &final_crl_set)) { | 56 if (!net::CRLSetStorage::ApplyDelta( |
| 57 crl_set.get(), delta_bytes, &final_crl_set)) { |
57 fprintf(stderr, "Failed to apply delta to CRLSet\n"); | 58 fprintf(stderr, "Failed to apply delta to CRLSet\n"); |
58 return 1; | 59 return 1; |
59 } | 60 } |
60 } else { | 61 } else { |
61 final_crl_set = crl_set; | 62 final_crl_set = crl_set; |
62 } | 63 } |
63 | 64 |
64 if (!output_filename.empty()) { | 65 if (!output_filename.empty()) { |
65 const std::string out = net::CRLSetStorage::Serialize(final_crl_set); | 66 const std::string out = net::CRLSetStorage::Serialize(final_crl_set.get()); |
66 if (base::WriteFile(output_filename, out.data(), out.size()) == -1) { | 67 if (base::WriteFile(output_filename, out.data(), out.size()) == -1) { |
67 fprintf(stderr, "Failed to write resulting CRL set\n"); | 68 fprintf(stderr, "Failed to write resulting CRL set\n"); |
68 return 1; | 69 return 1; |
69 } | 70 } |
70 } | 71 } |
71 | 72 |
72 const net::CRLSet::CRLList& crls = final_crl_set->crls(); | 73 const net::CRLSet::CRLList& crls = final_crl_set->crls(); |
73 for (net::CRLSet::CRLList::const_iterator i = crls.begin(); i != crls.end(); | 74 for (net::CRLSet::CRLList::const_iterator i = crls.begin(); i != crls.end(); |
74 i++) { | 75 i++) { |
75 printf("%s\n", base::HexEncode(i->first.data(), i->first.size()).c_str()); | 76 printf("%s\n", base::HexEncode(i->first.data(), i->first.size()).c_str()); |
76 for (std::vector<std::string>::const_iterator j = i->second.begin(); | 77 for (std::vector<std::string>::const_iterator j = i->second.begin(); |
77 j != i->second.end(); j++) { | 78 j != i->second.end(); j++) { |
78 printf(" %s\n", base::HexEncode(j->data(), j->size()).c_str()); | 79 printf(" %s\n", base::HexEncode(j->data(), j->size()).c_str()); |
79 } | 80 } |
80 } | 81 } |
81 | 82 |
82 return 0; | 83 return 0; |
83 } | 84 } |
OLD | NEW |