| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_SIGNER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_SIGNER_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_SIGNER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_SIGNER_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 public: | 21 public: |
| 22 static bool SignPayload(const std::string& unsigned_payload_path, | 22 static bool SignPayload(const std::string& unsigned_payload_path, |
| 23 const std::string& private_key_path, | 23 const std::string& private_key_path, |
| 24 std::vector<char>* out_signature_blob); | 24 std::vector<char>* out_signature_blob); |
| 25 | 25 |
| 26 // Returns the length of out_signature_blob that will result in a call | 26 // Returns the length of out_signature_blob that will result in a call |
| 27 // to SignPayload with a given private key. Returns true on success. | 27 // to SignPayload with a given private key. Returns true on success. |
| 28 static bool SignatureBlobLength(const std::string& private_key_path, | 28 static bool SignatureBlobLength(const std::string& private_key_path, |
| 29 uint64_t* out_length); | 29 uint64_t* out_length); |
| 30 | 30 |
| 31 // Returns false if the payload signature can't be verified. Returns true |
| 32 // otherwise and sets |out_hash| to the signed payload hash. |
| 33 static bool VerifySignature(const std::vector<char>& signature_blob, |
| 34 const std::string& public_key_path, |
| 35 std::vector<char>* out_hash_data); |
| 36 |
| 31 private: | 37 private: |
| 32 // This should never be constructed | 38 // This should never be constructed |
| 33 DISALLOW_IMPLICIT_CONSTRUCTORS(PayloadSigner); | 39 DISALLOW_IMPLICIT_CONSTRUCTORS(PayloadSigner); |
| 34 }; | 40 }; |
| 35 | 41 |
| 36 } // namespace chromeos_update_engine | 42 } // namespace chromeos_update_engine |
| 37 | 43 |
| 38 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_SIGNER_H__ | 44 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_PAYLOAD_SIGNER_H__ |
| OLD | NEW |