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 package com.ohos.entity; 17 18 import com.ohos.hapsigntool.entity.Options; 19 import com.ohos.hapsigntool.error.ParamException; 20 21 /** 22 * VerifyAppParameters. 23 * 24 * @since 2024/04/06 25 */ 26 public class VerifyAppParameters implements Parameters { 27 /** 28 * verify application package file, hap or elf format, required fields 29 */ 30 private String inFile; 31 32 /** 33 * verify certificate chain file, required fields 34 */ 35 private String outCertChain; 36 37 /** 38 * profile file in application package, required fields 39 */ 40 private String outProfile; 41 42 /** 43 * Enter the format of the original file. The supported file formats include ZIP, BIN, and ELF, default value ZIP 44 */ 45 private InForm inForm = InForm.ZIP; 46 47 @Override toOptions()48 public Options toOptions() throws ParamException { 49 Options options = new Options(); 50 if (inFile == null) { 51 throw new ParamException(Options.IN_FILE); 52 } 53 options.put(Options.IN_FILE, inFile); 54 55 if (outCertChain == null) { 56 throw new ParamException(Options.OUT_CERT_CHAIN); 57 } 58 options.put(Options.OUT_CERT_CHAIN, outCertChain); 59 60 if (outProfile == null) { 61 throw new ParamException(Options.OUT_PROFILE); 62 } 63 options.put(Options.OUT_PROFILE, outProfile); 64 65 if (inForm != null) { 66 options.put(Options.IN_FORM, inForm.getValue()); 67 } 68 return options; 69 } 70 getInFile()71 public String getInFile() { 72 return inFile; 73 } 74 setInFile(String inFile)75 public void setInFile(String inFile) { 76 this.inFile = inFile; 77 } 78 getOutCertChain()79 public String getOutCertChain() { 80 return outCertChain; 81 } 82 setOutCertChain(String outCertChain)83 public void setOutCertChain(String outCertChain) { 84 this.outCertChain = outCertChain; 85 } 86 getOutProfile()87 public String getOutProfile() { 88 return outProfile; 89 } 90 setOutProfile(String outProfile)91 public void setOutProfile(String outProfile) { 92 this.outProfile = outProfile; 93 } 94 getInForm()95 public InForm getInForm() { 96 return inForm; 97 } 98 setInForm(InForm inForm)99 public void setInForm(InForm inForm) { 100 this.inForm = inForm; 101 } 102 } 103