1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.util.apk;
18 
19 import android.annotation.NonNull;
20 
21 import java.nio.ByteBuffer;
22 
23 /**
24  * APK Signature Scheme v2 block and additional information relevant to verifying the signatures
25  * contained in the block against the file.
26  * @hide
27  */
28 public class SignatureInfo {
29     /** Contents of APK Signature Scheme v2 block. */
30     public final @NonNull ByteBuffer signatureBlock;
31 
32     /** Position of the APK Signing Block in the file. */
33     public final long apkSigningBlockOffset;
34 
35     /** Position of the ZIP Central Directory in the file. */
36     public final long centralDirOffset;
37 
38     /** Position of the ZIP End of Central Directory (EoCD) in the file. */
39     public final long eocdOffset;
40 
41     /** Contents of ZIP End of Central Directory (EoCD) of the file. */
42     public final @NonNull ByteBuffer eocd;
43 
SignatureInfo(@onNull ByteBuffer signatureBlock, long apkSigningBlockOffset, long centralDirOffset, long eocdOffset, @NonNull ByteBuffer eocd)44     SignatureInfo(@NonNull ByteBuffer signatureBlock, long apkSigningBlockOffset,
45             long centralDirOffset, long eocdOffset, @NonNull ByteBuffer eocd) {
46         this.signatureBlock = signatureBlock;
47         this.apkSigningBlockOffset = apkSigningBlockOffset;
48         this.centralDirOffset = centralDirOffset;
49         this.eocdOffset = eocdOffset;
50         this.eocd = eocd;
51     }
52 }
53