• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 /**
19  * Define class of hap signature block types
20  *
21  * @since 2024/03/16
22  */
23 public class SignatureBlockTypes {
24     /**
25      * type-value of hap signature block
26      */
27     public static final char SIGNATURE_BLOCK = 0;
28 
29     /**
30      * type-value of unsigned profile
31      */
32     public static final char PROFILE_NOSIGNED_BLOCK = 1;
33 
34     /**
35      * type-value of signed profile
36      */
37     public static final char PROFILE_SIGNED_BLOCK = 2;
38 
39     /**
40      * type-value of key rotation block
41      */
42     public static final char KEY_ROTATION_BLOCK = 3;
43 
44     /**
45      * Constructor of Method
46      */
SignatureBlockTypes()47     private SignatureBlockTypes() {
48     }
49 
50     /**
51      * get profile block type by the flag of isSigned
52      *
53      * @param isSigned the flag whether profile is signed
54      * @return profile block type value
55      */
getProfileBlockTypes(String isSigned)56     public static char getProfileBlockTypes(String isSigned) {
57         if ("0".equals(isSigned)) {
58             return PROFILE_NOSIGNED_BLOCK;
59         }
60         if ("1".equals(isSigned)) {
61             return PROFILE_SIGNED_BLOCK;
62         }
63         return PROFILE_NOSIGNED_BLOCK;
64     }
65 }