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.codesigning.fsverity; 17 18 /** 19 * FsVerity hash algorithm 20 * 21 * @since 2023/06/05 22 */ 23 public enum FsVerityHashAlgorithm { 24 SHA256((byte) 1, "SHA-256", 256 / 8), 25 SHA512((byte) 2, "SHA-512", 512 / 8); 26 27 private final byte id; 28 29 private final String hashAlgorithm; 30 31 private final int outputByteSize; 32 FsVerityHashAlgorithm(byte id, String hashAlgorithm, int outputByteSize)33 FsVerityHashAlgorithm(byte id, String hashAlgorithm, int outputByteSize) { 34 this.id = id; 35 this.hashAlgorithm = hashAlgorithm; 36 this.outputByteSize = outputByteSize; 37 } 38 getId()39 public byte getId() { 40 return id; 41 } 42 getHashAlgorithm()43 public String getHashAlgorithm() { 44 return hashAlgorithm; 45 } 46 getOutputByteSize()47 public int getOutputByteSize() { 48 return outputByteSize; 49 } 50 } 51