• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2023 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 package com.ohos.hapsigntool.hap.entity;
17 
18 import com.ohos.hapsigntool.utils.FileUtils;
19 
20 /**
21  * sign block data
22  *
23  * @since 2023-11-07
24  */
25 public class SignBlockData {
26     private char type;
27     private byte[] blockHead;
28     private byte[] signData;
29     private String signFile;
30     private long len;
31     private boolean isByte;
32 
SignBlockData(byte[] signData, char type)33     public SignBlockData(byte[] signData, char type) {
34         this.signData = signData;
35         this.type = type;
36         this.len = signData == null ? 0 : signData.length;
37         this.isByte = true;
38     }
39 
SignBlockData(String signFile, char type)40     public SignBlockData(String signFile, char type) {
41         this.signFile = signFile;
42         this.type = type;
43         this.len = FileUtils.getFileLen(signFile);
44         this.isByte = false;
45     }
46 
getType()47     public char getType() {
48         return type;
49     }
50 
setType(char type)51     public void setType(char type) {
52         this.type = type;
53     }
54 
getBlockHead()55     public byte[] getBlockHead() {
56         return blockHead;
57     }
58 
setBlockHead(byte[] blockHead)59     public void setBlockHead(byte[] blockHead) {
60         this.blockHead = blockHead;
61     }
62 
getSignData()63     public byte[] getSignData() {
64         return signData;
65     }
66 
setSignData(byte[] signData)67     public void setSignData(byte[] signData) {
68         this.signData = signData;
69     }
70 
getSignFile()71     public String getSignFile() {
72         return signFile;
73     }
74 
setSignFile(String signFile)75     public void setSignFile(String signFile) {
76         this.signFile = signFile;
77     }
78 
getLen()79     public long getLen() {
80         return len;
81     }
82 
setLen(long len)83     public void setLen(long len) {
84         this.len = len;
85     }
86 
isByte()87     public boolean isByte() {
88         return isByte;
89     }
90 
setByte(boolean isByte)91     public void setByte(boolean isByte) {
92         this.isByte = isByte;
93     }
94 }
95