| 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 20 matching lines...) Expand all Loading... |
| 31 if (argc < 2 || argc > 4) | 31 if (argc < 2 || argc > 4) |
| 32 return Usage(argv[0]); | 32 return Usage(argv[0]); |
| 33 | 33 |
| 34 crl_set_filename = base::FilePath::FromUTF8Unsafe(argv[1]); | 34 crl_set_filename = base::FilePath::FromUTF8Unsafe(argv[1]); |
| 35 if (argc >= 3) | 35 if (argc >= 3) |
| 36 delta_filename = base::FilePath::FromUTF8Unsafe(argv[2]); | 36 delta_filename = base::FilePath::FromUTF8Unsafe(argv[2]); |
| 37 if (argc >= 4) | 37 if (argc >= 4) |
| 38 output_filename = base::FilePath::FromUTF8Unsafe(argv[3]); | 38 output_filename = base::FilePath::FromUTF8Unsafe(argv[3]); |
| 39 | 39 |
| 40 std::string crl_set_bytes, delta_bytes; | 40 std::string crl_set_bytes, delta_bytes; |
| 41 if (!file_util::ReadFileToString(crl_set_filename, &crl_set_bytes)) | 41 if (!base::ReadFileToString(crl_set_filename, &crl_set_bytes)) |
| 42 return 1; | 42 return 1; |
| 43 if (!delta_filename.empty() && | 43 if (!delta_filename.empty() && |
| 44 !file_util::ReadFileToString(delta_filename, &delta_bytes)) { | 44 !base::ReadFileToString(delta_filename, &delta_bytes)) { |
| 45 return 1; | 45 return 1; |
| 46 } | 46 } |
| 47 | 47 |
| 48 scoped_refptr<net::CRLSet> crl_set, final_crl_set; | 48 scoped_refptr<net::CRLSet> crl_set, final_crl_set; |
| 49 if (!net::CRLSet::Parse(crl_set_bytes, &crl_set)) { | 49 if (!net::CRLSet::Parse(crl_set_bytes, &crl_set)) { |
| 50 fprintf(stderr, "Failed to parse CRLSet\n"); | 50 fprintf(stderr, "Failed to parse CRLSet\n"); |
| 51 return 1; | 51 return 1; |
| 52 } | 52 } |
| 53 | 53 |
| 54 if (!delta_bytes.empty()) { | 54 if (!delta_bytes.empty()) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 i++) { | 74 i++) { |
| 75 printf("%s\n", base::HexEncode(i->first.data(), i->first.size()).c_str()); | 75 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(); | 76 for (std::vector<std::string>::const_iterator j = i->second.begin(); |
| 77 j != i->second.end(); j++) { | 77 j != i->second.end(); j++) { |
| 78 printf(" %s\n", base::HexEncode(j->data(), j->size()).c_str()); | 78 printf(" %s\n", base::HexEncode(j->data(), j->size()).c_str()); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 return 0; | 82 return 0; |
| 83 } | 83 } |
| OLD | NEW |