blob: 9b966d5cc01b1c17edfabc8c51df974f7e6f96f7 [file] [log] [blame]
Darren Krahn69a3dbc2015-09-22 16:21:04 -07001// Copyright 2015 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#include <cstdio>
16#include <memory>
17#include <string>
18#include <vector>
19
20#include "base/command_line.h"
Darren Krahn251cb282015-09-28 08:51:18 -070021#include "base/files/file_util.h"
Darren Krahn82f4f5b2016-03-03 16:21:07 -080022#include "base/strings/string_util.h"
Darren Krahn69a3dbc2015-09-22 16:21:04 -070023#include "keymaster/authorization_set.h"
Shawn Willdend3fac682016-01-26 13:50:17 -070024#include "keymaster/keymaster_tags.h"
Darren Krahn69a3dbc2015-09-22 16:21:04 -070025#include "keystore/keystore_client_impl.h"
26
27using base::CommandLine;
28using keymaster::AuthorizationSet;
29using keymaster::AuthorizationSetBuilder;
30using keystore::KeystoreClient;
31
32namespace {
33
Darren Krahna9474ab2015-11-03 14:38:53 -080034struct TestCase {
35 std::string name;
36 bool required_for_brillo_pts;
37 AuthorizationSet parameters;
38};
39
Darren Krahn69a3dbc2015-09-22 16:21:04 -070040void PrintUsageAndExit() {
41 printf("Usage: keystore_client_v2 <command> [options]\n");
Darren Krahn82f4f5b2016-03-03 16:21:07 -080042 printf("Commands: brillo-platform-test [--prefix=<test_name_prefix>] [--test_for_0_3]\n"
Darren Krahna9474ab2015-11-03 14:38:53 -080043 " list-brillo-tests\n"
44 " add-entropy --input=<entropy>\n"
Darren Krahn69a3dbc2015-09-22 16:21:04 -070045 " generate --name=<key_name>\n"
46 " get-chars --name=<key_name>\n"
47 " export --name=<key_name>\n"
48 " delete --name=<key_name>\n"
49 " delete-all\n"
50 " exists --name=<key_name>\n"
51 " list [--prefix=<key_name_prefix>]\n"
Darren Krahn251cb282015-09-28 08:51:18 -070052 " sign-verify --name=<key_name>\n"
53 " [en|de]crypt --name=<key_name> --in=<file> --out=<file>\n");
Darren Krahn69a3dbc2015-09-22 16:21:04 -070054 exit(1);
55}
56
57std::unique_ptr<KeystoreClient> CreateKeystoreInstance() {
58 return std::unique_ptr<KeystoreClient>(new keystore::KeystoreClientImpl);
59}
60
Shawn Willdend3fac682016-01-26 13:50:17 -070061#ifndef KEYMASTER_NAME_TAGS
Darren Krahn82f4f5b2016-03-03 16:21:07 -080062#error KEYMASTER_NAME_TAGS must be defined
Shawn Willdend3fac682016-01-26 13:50:17 -070063#endif
Darren Krahna9474ab2015-11-03 14:38:53 -080064
65void PrintTags(const AuthorizationSet& parameters) {
66 const keymaster_key_param_t* iter = nullptr;
67 for (iter = parameters.begin(); iter != parameters.end(); ++iter) {
Shawn Willdend3fac682016-01-26 13:50:17 -070068 printf(" %s\n", keymaster::StringifyTag(iter->tag));
Darren Krahna9474ab2015-11-03 14:38:53 -080069 }
70}
71
72void PrintKeyCharacteristics(const AuthorizationSet& hardware_enforced_characteristics,
73 const AuthorizationSet& software_enforced_characteristics) {
74 printf("Hardware:\n");
75 PrintTags(hardware_enforced_characteristics);
76 printf("Software:\n");
77 PrintTags(software_enforced_characteristics);
78}
79
80bool TestKey(const std::string& name, bool required, const AuthorizationSet& parameters) {
81 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
82 AuthorizationSet hardware_enforced_characteristics;
83 AuthorizationSet software_enforced_characteristics;
84 int32_t result = keystore->generateKey("tmp", parameters, &hardware_enforced_characteristics,
85 &software_enforced_characteristics);
Darren Krahn82f4f5b2016-03-03 16:21:07 -080086 const char kBoldRedAbort[] = "\033[1;31mABORT\033[0m";
Darren Krahna9474ab2015-11-03 14:38:53 -080087 if (result != KM_ERROR_OK) {
88 LOG(ERROR) << "Failed to generate key: " << result;
Darren Krahn82f4f5b2016-03-03 16:21:07 -080089 printf("[%s] %s\n", kBoldRedAbort, name.c_str());
Darren Krahna9474ab2015-11-03 14:38:53 -080090 return false;
91 }
92 result = keystore->deleteKey("tmp");
93 if (result != KM_ERROR_OK) {
94 LOG(ERROR) << "Failed to delete key: " << result;
Darren Krahn82f4f5b2016-03-03 16:21:07 -080095 printf("[%s] %s\n", kBoldRedAbort, name.c_str());
Darren Krahna9474ab2015-11-03 14:38:53 -080096 return false;
97 }
98 printf("===============================================================\n");
99 printf("%s Key Characteristics:\n", name.c_str());
100 PrintKeyCharacteristics(hardware_enforced_characteristics, software_enforced_characteristics);
101 bool hardware_backed = (hardware_enforced_characteristics.size() > 0);
Darren Krahn01fc9a42016-03-04 11:41:23 -0800102 if (software_enforced_characteristics.GetTagCount(KM_TAG_ALGORITHM) > 0 ||
Darren Krahna9474ab2015-11-03 14:38:53 -0800103 software_enforced_characteristics.GetTagCount(KM_TAG_KEY_SIZE) > 0 ||
Darren Krahn82f4f5b2016-03-03 16:21:07 -0800104 software_enforced_characteristics.GetTagCount(KM_TAG_RSA_PUBLIC_EXPONENT) > 0) {
Darren Krahna9474ab2015-11-03 14:38:53 -0800105 VLOG(1) << "Hardware-backed key but required characteristics enforced in software.";
106 hardware_backed = false;
107 }
108 const char kBoldRedFail[] = "\033[1;31mFAIL\033[0m";
109 const char kBoldGreenPass[] = "\033[1;32mPASS\033[0m";
110 const char kBoldYellowWarn[] = "\033[1;33mWARN\033[0m";
111 printf("[%s] %s\n",
112 hardware_backed ? kBoldGreenPass : (required ? kBoldRedFail : kBoldYellowWarn),
113 name.c_str());
114
115 return (hardware_backed || !required);
116}
117
118AuthorizationSet GetRSASignParameters(uint32_t key_size, bool sha256_only) {
119 AuthorizationSetBuilder parameters;
120 parameters.RsaSigningKey(key_size, 65537)
121 .Digest(KM_DIGEST_SHA_2_256)
122 .Padding(KM_PAD_RSA_PKCS1_1_5_SIGN)
123 .Padding(KM_PAD_RSA_PSS)
124 .Authorization(keymaster::TAG_NO_AUTH_REQUIRED);
125 if (!sha256_only) {
126 parameters.Digest(KM_DIGEST_SHA_2_224)
127 .Digest(KM_DIGEST_SHA_2_384)
128 .Digest(KM_DIGEST_SHA_2_512);
129 }
130 return parameters.build();
131}
132
133AuthorizationSet GetRSAEncryptParameters(uint32_t key_size) {
134 AuthorizationSetBuilder parameters;
135 parameters.RsaEncryptionKey(key_size, 65537)
136 .Padding(KM_PAD_RSA_PKCS1_1_5_ENCRYPT)
137 .Padding(KM_PAD_RSA_OAEP)
138 .Authorization(keymaster::TAG_NO_AUTH_REQUIRED);
139 return parameters.build();
140}
141
142AuthorizationSet GetECDSAParameters(uint32_t key_size, bool sha256_only) {
143 AuthorizationSetBuilder parameters;
144 parameters.EcdsaSigningKey(key_size)
145 .Digest(KM_DIGEST_SHA_2_256)
146 .Authorization(keymaster::TAG_NO_AUTH_REQUIRED);
147 if (!sha256_only) {
148 parameters.Digest(KM_DIGEST_SHA_2_224)
149 .Digest(KM_DIGEST_SHA_2_384)
150 .Digest(KM_DIGEST_SHA_2_512);
151 }
152 return parameters.build();
153}
154
155AuthorizationSet GetAESParameters(uint32_t key_size, bool with_gcm_mode) {
156 AuthorizationSetBuilder parameters;
157 parameters.AesEncryptionKey(key_size).Authorization(keymaster::TAG_NO_AUTH_REQUIRED);
158 if (with_gcm_mode) {
159 parameters.Authorization(keymaster::TAG_BLOCK_MODE, KM_MODE_GCM)
160 .Authorization(keymaster::TAG_MIN_MAC_LENGTH, 128);
161 } else {
162 parameters.Authorization(keymaster::TAG_BLOCK_MODE, KM_MODE_ECB);
163 parameters.Authorization(keymaster::TAG_BLOCK_MODE, KM_MODE_CBC);
164 parameters.Authorization(keymaster::TAG_BLOCK_MODE, KM_MODE_CTR);
165 }
166 return parameters.build();
167}
168
169AuthorizationSet GetHMACParameters(uint32_t key_size, keymaster_digest_t digest) {
170 AuthorizationSetBuilder parameters;
171 parameters.HmacKey(key_size)
172 .Digest(digest)
173 .Authorization(keymaster::TAG_MIN_MAC_LENGTH, 224)
174 .Authorization(keymaster::TAG_NO_AUTH_REQUIRED);
175 return parameters.build();
176}
177
178std::vector<TestCase> GetTestCases() {
179 TestCase test_cases[] = {
180 {"RSA-2048 Sign", true, GetRSASignParameters(2048, true)},
181 {"RSA-2048 Sign (more digests)", false, GetRSASignParameters(2048, false)},
182 {"RSA-3072 Sign", false, GetRSASignParameters(3072, false)},
183 {"RSA-4096 Sign", false, GetRSASignParameters(4096, false)},
184 {"RSA-2048 Encrypt", true, GetRSAEncryptParameters(2048)},
185 {"RSA-3072 Encrypt", false, GetRSAEncryptParameters(3072)},
186 {"RSA-4096 Encrypt", false, GetRSAEncryptParameters(4096)},
187 {"ECDSA-P256 Sign", true, GetECDSAParameters(256, true)},
188 {"ECDSA-P256 Sign (more digests)", false, GetECDSAParameters(256, false)},
189 {"ECDSA-P224 Sign", false, GetECDSAParameters(224, false)},
190 {"ECDSA-P384 Sign", false, GetECDSAParameters(384, false)},
191 {"ECDSA-P521 Sign", false, GetECDSAParameters(521, false)},
192 {"AES-128", true, GetAESParameters(128, false)},
193 {"AES-256", true, GetAESParameters(256, false)},
194 {"AES-128-GCM", false, GetAESParameters(128, true)},
195 {"AES-256-GCM", false, GetAESParameters(256, true)},
196 {"HMAC-SHA256-16", true, GetHMACParameters(16, KM_DIGEST_SHA_2_256)},
197 {"HMAC-SHA256-32", true, GetHMACParameters(32, KM_DIGEST_SHA_2_256)},
198 {"HMAC-SHA256-64", false, GetHMACParameters(64, KM_DIGEST_SHA_2_256)},
199 {"HMAC-SHA224-32", false, GetHMACParameters(32, KM_DIGEST_SHA_2_224)},
200 {"HMAC-SHA384-32", false, GetHMACParameters(32, KM_DIGEST_SHA_2_384)},
201 {"HMAC-SHA512-32", false, GetHMACParameters(32, KM_DIGEST_SHA_2_512)},
202 };
203 return std::vector<TestCase>(&test_cases[0], &test_cases[arraysize(test_cases)]);
204}
205
Darren Krahn82f4f5b2016-03-03 16:21:07 -0800206int BrilloPlatformTest(const std::string& prefix, bool test_for_0_3) {
207 const char kBoldYellowWarning[] = "\033[1;33mWARNING\033[0m";
208 if (test_for_0_3) {
209 printf("%s: Testing for keymaster v0.3. "
210 "This does not meet Brillo requirements.\n", kBoldYellowWarning);
211 }
Darren Krahna9474ab2015-11-03 14:38:53 -0800212 int test_count = 0;
213 int fail_count = 0;
214 std::vector<TestCase> test_cases = GetTestCases();
215 for (const auto& test_case : test_cases) {
Darren Krahn82f4f5b2016-03-03 16:21:07 -0800216 if (!prefix.empty() &&
217 !base::StartsWith(test_case.name, prefix, base::CompareCase::SENSITIVE)) {
218 continue;
219 }
220 if (test_for_0_3 &&
221 (base::StartsWith(test_case.name, "AES", base::CompareCase::SENSITIVE) ||
222 base::StartsWith(test_case.name, "HMAC", base::CompareCase::SENSITIVE))) {
Darren Krahna9474ab2015-11-03 14:38:53 -0800223 continue;
224 }
225 ++test_count;
226 if (!TestKey(test_case.name, test_case.required_for_brillo_pts, test_case.parameters)) {
227 VLOG(1) << "Test failed: " << test_case.name;
228 ++fail_count;
229 }
230 }
231 return fail_count;
232}
233
234int ListTestCases() {
235 const char kBoldGreenRequired[] = "\033[1;32mREQUIRED\033[0m";
236 const char kBoldYellowRecommended[] = "\033[1;33mRECOMMENDED\033[0m";
237 std::vector<TestCase> test_cases = GetTestCases();
238 for (const auto& test_case : test_cases) {
239 printf("%s : %s\n", test_case.name.c_str(),
240 test_case.required_for_brillo_pts ? kBoldGreenRequired : kBoldYellowRecommended);
241 }
242 return 0;
243}
244
Darren Krahn251cb282015-09-28 08:51:18 -0700245std::string ReadFile(const std::string& filename) {
246 std::string content;
247 base::FilePath path(filename);
248 if (!base::ReadFileToString(path, &content)) {
249 printf("Failed to read file: %s\n", filename.c_str());
250 exit(1);
251 }
252 return content;
253}
254
255void WriteFile(const std::string& filename, const std::string& content) {
256 base::FilePath path(filename);
257 int size = content.size();
258 if (base::WriteFile(path, content.data(), size) != size) {
259 printf("Failed to write file: %s\n", filename.c_str());
260 exit(1);
261 }
262}
263
Darren Krahn69a3dbc2015-09-22 16:21:04 -0700264int AddEntropy(const std::string& input) {
265 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
266 int32_t result = keystore->addRandomNumberGeneratorEntropy(input);
267 printf("AddEntropy: %d\n", result);
268 return result;
269}
270
271int GenerateKey(const std::string& name) {
272 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
273 AuthorizationSetBuilder params;
274 params.RsaSigningKey(2048, 65537)
275 .Digest(KM_DIGEST_SHA_2_224)
276 .Digest(KM_DIGEST_SHA_2_256)
277 .Digest(KM_DIGEST_SHA_2_384)
278 .Digest(KM_DIGEST_SHA_2_512)
279 .Padding(KM_PAD_RSA_PKCS1_1_5_SIGN)
280 .Padding(KM_PAD_RSA_PSS)
281 .Authorization(keymaster::TAG_NO_AUTH_REQUIRED);
282 AuthorizationSet hardware_enforced_characteristics;
283 AuthorizationSet software_enforced_characteristics;
284 int32_t result = keystore->generateKey(name, params.build(), &hardware_enforced_characteristics,
285 &software_enforced_characteristics);
Darren Krahna9474ab2015-11-03 14:38:53 -0800286 printf("GenerateKey: %d\n", result);
287 if (result == KM_ERROR_OK) {
288 PrintKeyCharacteristics(hardware_enforced_characteristics,
289 software_enforced_characteristics);
290 }
Darren Krahn69a3dbc2015-09-22 16:21:04 -0700291 return result;
292}
293
294int GetCharacteristics(const std::string& name) {
295 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
296 AuthorizationSet hardware_enforced_characteristics;
297 AuthorizationSet software_enforced_characteristics;
298 int32_t result = keystore->getKeyCharacteristics(name, &hardware_enforced_characteristics,
299 &software_enforced_characteristics);
Darren Krahna9474ab2015-11-03 14:38:53 -0800300 printf("GetCharacteristics: %d\n", result);
301 if (result == KM_ERROR_OK) {
302 PrintKeyCharacteristics(hardware_enforced_characteristics,
303 software_enforced_characteristics);
304 }
Darren Krahn69a3dbc2015-09-22 16:21:04 -0700305 return result;
306}
307
308int ExportKey(const std::string& name) {
309 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
310 std::string data;
311 int32_t result = keystore->exportKey(KM_KEY_FORMAT_X509, name, &data);
312 printf("ExportKey: %d (%zu)\n", result, data.size());
313 return result;
314}
315
316int DeleteKey(const std::string& name) {
317 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
318 int32_t result = keystore->deleteKey(name);
319 printf("DeleteKey: %d\n", result);
320 return result;
321}
322
323int DeleteAllKeys() {
324 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
325 int32_t result = keystore->deleteAllKeys();
326 printf("DeleteAllKeys: %d\n", result);
327 return result;
328}
329
330int DoesKeyExist(const std::string& name) {
331 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
332 printf("DoesKeyExist: %s\n", keystore->doesKeyExist(name) ? "yes" : "no");
333 return 0;
334}
335
336int List(const std::string& prefix) {
337 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
338 std::vector<std::string> key_list;
339 if (!keystore->listKeys(prefix, &key_list)) {
340 printf("ListKeys failed.\n");
341 return 1;
342 }
343 printf("Keys:\n");
344 for (const auto& key_name : key_list) {
345 printf(" %s\n", key_name.c_str());
346 }
347 return 0;
348}
349
350int SignAndVerify(const std::string& name) {
351 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
352 AuthorizationSetBuilder sign_params;
353 sign_params.Padding(KM_PAD_RSA_PKCS1_1_5_SIGN);
354 sign_params.Digest(KM_DIGEST_SHA_2_256);
355 AuthorizationSet output_params;
356 keymaster_operation_handle_t handle;
357 int32_t result = keystore->beginOperation(KM_PURPOSE_SIGN, name, sign_params.build(),
358 &output_params, &handle);
359 if (result != KM_ERROR_OK) {
360 printf("Sign: BeginOperation failed: %d\n", result);
361 return result;
362 }
363 AuthorizationSet empty_params;
364 size_t num_input_bytes_consumed;
365 std::string output_data;
366 result = keystore->updateOperation(handle, empty_params, "data_to_sign",
367 &num_input_bytes_consumed, &output_params, &output_data);
368 if (result != KM_ERROR_OK) {
369 printf("Sign: UpdateOperation failed: %d\n", result);
370 return result;
371 }
372 result = keystore->finishOperation(handle, empty_params, std::string() /*signature_to_verify*/,
373 &output_params, &output_data);
374 if (result != KM_ERROR_OK) {
375 printf("Sign: FinishOperation failed: %d\n", result);
376 return result;
377 }
378 printf("Sign: %zu bytes.\n", output_data.size());
379 // We have a signature, now verify it.
380 std::string signature_to_verify = output_data;
Darren Krahn251cb282015-09-28 08:51:18 -0700381 output_data.clear();
Darren Krahn69a3dbc2015-09-22 16:21:04 -0700382 result = keystore->beginOperation(KM_PURPOSE_VERIFY, name, sign_params.build(), &output_params,
383 &handle);
384 if (result != KM_ERROR_OK) {
385 printf("Verify: BeginOperation failed: %d\n", result);
386 return result;
387 }
388 result = keystore->updateOperation(handle, empty_params, "data_to_sign",
389 &num_input_bytes_consumed, &output_params, &output_data);
390 if (result != KM_ERROR_OK) {
391 printf("Verify: UpdateOperation failed: %d\n", result);
392 return result;
393 }
394 result = keystore->finishOperation(handle, empty_params, signature_to_verify, &output_params,
395 &output_data);
396 if (result == KM_ERROR_VERIFICATION_FAILED) {
397 printf("Verify: Failed to verify signature.\n");
398 return result;
399 }
400 if (result != KM_ERROR_OK) {
401 printf("Verify: FinishOperation failed: %d\n", result);
402 return result;
403 }
404 printf("Verify: OK\n");
405 return 0;
406}
407
Darren Krahn251cb282015-09-28 08:51:18 -0700408int Encrypt(const std::string& key_name, const std::string& input_filename,
409 const std::string& output_filename) {
410 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
411 std::string input = ReadFile(input_filename);
412 std::string output;
413 if (!keystore->encryptWithAuthentication(key_name, input, &output)) {
414 printf("EncryptWithAuthentication failed.\n");
415 return 1;
416 }
417 WriteFile(output_filename, output);
418 return 0;
419}
420
421int Decrypt(const std::string& key_name, const std::string& input_filename,
422 const std::string& output_filename) {
423 std::unique_ptr<KeystoreClient> keystore = CreateKeystoreInstance();
424 std::string input = ReadFile(input_filename);
425 std::string output;
426 if (!keystore->decryptWithAuthentication(key_name, input, &output)) {
427 printf("DecryptWithAuthentication failed.\n");
428 return 1;
429 }
430 WriteFile(output_filename, output);
431 return 0;
432}
433
Darren Krahn69a3dbc2015-09-22 16:21:04 -0700434} // namespace
435
436int main(int argc, char** argv) {
437 CommandLine::Init(argc, argv);
438 CommandLine* command_line = CommandLine::ForCurrentProcess();
439 CommandLine::StringVector args = command_line->GetArgs();
440 if (args.empty()) {
441 PrintUsageAndExit();
442 }
Darren Krahna9474ab2015-11-03 14:38:53 -0800443 if (args[0] == "brillo-platform-test") {
Darren Krahn82f4f5b2016-03-03 16:21:07 -0800444 return BrilloPlatformTest(command_line->GetSwitchValueASCII("prefix"),
445 command_line->HasSwitch("test_for_0_3"));
Darren Krahna9474ab2015-11-03 14:38:53 -0800446 } else if (args[0] == "list-brillo-tests") {
447 return ListTestCases();
448 } else if (args[0] == "add-entropy") {
Darren Krahn69a3dbc2015-09-22 16:21:04 -0700449 return AddEntropy(command_line->GetSwitchValueASCII("input"));
450 } else if (args[0] == "generate") {
451 return GenerateKey(command_line->GetSwitchValueASCII("name"));
452 } else if (args[0] == "get-chars") {
453 return GetCharacteristics(command_line->GetSwitchValueASCII("name"));
454 } else if (args[0] == "export") {
455 return ExportKey(command_line->GetSwitchValueASCII("name"));
456 } else if (args[0] == "delete") {
457 return DeleteKey(command_line->GetSwitchValueASCII("name"));
458 } else if (args[0] == "delete-all") {
459 return DeleteAllKeys();
460 } else if (args[0] == "exists") {
461 return DoesKeyExist(command_line->GetSwitchValueASCII("name"));
462 } else if (args[0] == "list") {
463 return List(command_line->GetSwitchValueASCII("prefix"));
464 } else if (args[0] == "sign-verify") {
465 return SignAndVerify(command_line->GetSwitchValueASCII("name"));
Darren Krahn251cb282015-09-28 08:51:18 -0700466 } else if (args[0] == "encrypt") {
467 return Encrypt(command_line->GetSwitchValueASCII("name"),
468 command_line->GetSwitchValueASCII("in"),
469 command_line->GetSwitchValueASCII("out"));
470 } else if (args[0] == "decrypt") {
471 return Decrypt(command_line->GetSwitchValueASCII("name"),
472 command_line->GetSwitchValueASCII("in"),
473 command_line->GetSwitchValueASCII("out"));
Darren Krahn69a3dbc2015-09-22 16:21:04 -0700474 } else {
475 PrintUsageAndExit();
476 }
477 return 0;
478}