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 SIGNATURETOOLS_FSVERITY_DESCRIPTOR_WITH_SIGN_H 16 #define SIGNATURETOOLS_FSVERITY_DESCRIPTOR_WITH_SIGN_H 17 18 #include <vector> 19 #include <string> 20 21 #include "fs_verity_descriptor.h" 22 23 namespace OHOS { 24 namespace SignatureTools { 25 class FsVerityDescriptorWithSign { 26 public: 27 static constexpr int32_t INTEGER_BYTES = 4; 28 29 public: 30 FsVerityDescriptorWithSign(); 31 FsVerityDescriptorWithSign(FsVerityDescriptor fsVerityDescriptor, const std::vector<int8_t> &signature); 32 FsVerityDescriptorWithSign(int32_t type, int32_t length, FsVerityDescriptor fsVerityDescriptor, 33 const std::vector<int8_t> &signature); 34 int32_t Size(); 35 void ToByteArray(std::vector<int8_t> &ret); 36 FsVerityDescriptor GetFsVerityDescriptor(); 37 std::vector<int8_t>& GetSignature(); 38 39 private: 40 int32_t type = FsVerityDescriptor::FS_VERITY_DESCRIPTOR_TYPE;; 41 int32_t length; 42 FsVerityDescriptor fsVerityDescriptor; 43 std::vector<int8_t> signature; 44 }; 45 } // namespace SignatureTools 46 } // namespace OHOS 47 #endif // SIGNATURETOOLS_FSVERITY_DIGEST_H