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#include "sign_block_data.h" 17 18namespace OHOS { 19namespace SignatureTools { 20 21SignBlockData::SignBlockData(const std::vector<int8_t>& signData, const char type) 22{ 23 m_signData = std::move(signData); 24 m_type = type; 25 m_len = signData.size(); 26 m_isByte = true; 27} 28 29SignBlockData::SignBlockData(const std::string& signFile, const char type) 30{ 31 m_signFile = std::move(signFile); 32 m_type = type; 33 m_len = FileUtils::GetFileLen(signFile); 34 m_isByte = false; 35} 36 37char SignBlockData::GetType() 38{ 39 return m_type; 40} 41 42std::vector<int8_t>& SignBlockData::GetBlockHead() 43{ 44 return m_blockHead; 45} 46 47void SignBlockData::SetBlockHead(const std::vector<int8_t>& blockHead) 48{ 49 m_blockHead = std::move(blockHead); 50} 51 52std::vector<int8_t>& SignBlockData::GetSignData() 53{ 54 return m_signData; 55} 56 57std::string SignBlockData::GetSignFile() 58{ 59 return m_signFile; 60} 61 62long SignBlockData::GetLen() 63{ 64 return m_len; 65} 66 67bool SignBlockData::GetByte() 68{ 69 return m_isByte; 70} 71 72} // namespace SignatureTools 73} // namespace OHOS