1 /* 2 * Copyright (c) 2024-2024 Huawei Device Co., Ltd. 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 16 #ifndef SIGNATRUETOOLS_SIGN_HEAD_H 17 #define SIGNATRUETOOLS_SIGN_HEAD_H 18 19 #include <string> 20 #include <vector> 21 22 namespace OHOS { 23 namespace SignatureTools { 24 class SignHead { 25 public: 26 SignHead(); 27 28 std::vector<int8_t> GetSignHead(const int subBlockSize); 29 static const int SIGN_HEAD_LEN; 30 static const std::string MAGIC; 31 static const std::string ELF_MAGIC; 32 static const std::string VERSION; 33 static const int32_t ELF_BLOCK_LEN; 34 static const int32_t BIN_BLOCK_LEN; 35 static std::vector<int8_t> GetSignHeadLittleEndian(const int subBlockSize, const int subBlockNum); 36 37 private: 38 static const int NUM_OF_BLOCK; 39 static const int RESERVE_LENGTH; 40 static std::vector<int8_t> m_reserve; 41 }; 42 } // namespace SignatureTools 43 } // namespace OHOS 44 #endif