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 #ifndef SIGNATRUETOOLS_SIGNED_FILE_POS_H 16 #define SIGNATRUETOOLS_SIGNED_FILE_POS_H 17 18 #include <vector> 19 #include <string> 20 #include <memory> 21 #include <cstdint> 22 23 #include "byte_buffer.h" 24 25 namespace OHOS { 26 namespace SignatureTools { 27 28 class SignedFilePos { 29 public: 30 SignedFilePos(int32_t fileNameOffset, 31 int32_t fileNameSize, 32 int32_t signInfoOffset, 33 int32_t signInfoSize); 34 static SignedFilePos FromByteArray(std::vector<int8_t> &bytes); 35 int32_t GetFileNameOffset(); 36 int32_t GetFileNameSize(); 37 int32_t GetSignInfoOffset(); 38 int32_t GetSignInfoSize(); 39 void IncreaseFileNameOffset(int32_t incOffset); 40 void IncreaseSignInfoOffset(int32_t incOffset); 41 42 private: 43 int32_t fileNameOffset; 44 int32_t fileNameSize; 45 int32_t signInfoOffset; 46 int32_t signInfoSize; 47 }; 48 } // namespace SignatureTools 49 } // namespace OHOS 50 #endif // SIGNATRUETOOLS_SIGNED_FILE_POS_H