1 /* 2 * Copyright (C) 2020 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 com.android.apksig; 18 19 import com.android.apksig.internal.apk.stamp.SourceStampConstants; 20 import com.android.apksig.internal.apk.v1.V1SchemeConstants; 21 import com.android.apksig.internal.apk.v2.V2SchemeConstants; 22 import com.android.apksig.internal.apk.v3.V3SchemeConstants; 23 24 /** 25 * Exports internally defined constants to allow clients to reference these values without relying 26 * on internal code. 27 */ 28 public class Constants { Constants()29 private Constants() {} 30 31 public static final int VERSION_SOURCE_STAMP = 0; 32 public static final int VERSION_JAR_SIGNATURE_SCHEME = 1; 33 public static final int VERSION_APK_SIGNATURE_SCHEME_V2 = 2; 34 public static final int VERSION_APK_SIGNATURE_SCHEME_V3 = 3; 35 public static final int VERSION_APK_SIGNATURE_SCHEME_V31 = 31; 36 public static final int VERSION_APK_SIGNATURE_SCHEME_V4 = 4; 37 38 /** 39 * The maximum number of signers supported by the v1 and v2 APK Signature Schemes. 40 */ 41 public static final int MAX_APK_SIGNERS = 10; 42 43 public static final String MANIFEST_ENTRY_NAME = V1SchemeConstants.MANIFEST_ENTRY_NAME; 44 45 public static final int APK_SIGNATURE_SCHEME_V2_BLOCK_ID = 46 V2SchemeConstants.APK_SIGNATURE_SCHEME_V2_BLOCK_ID; 47 48 public static final int APK_SIGNATURE_SCHEME_V3_BLOCK_ID = 49 V3SchemeConstants.APK_SIGNATURE_SCHEME_V3_BLOCK_ID; 50 public static final int APK_SIGNATURE_SCHEME_V31_BLOCK_ID = 51 V3SchemeConstants.APK_SIGNATURE_SCHEME_V31_BLOCK_ID; 52 public static final int PROOF_OF_ROTATION_ATTR_ID = V3SchemeConstants.PROOF_OF_ROTATION_ATTR_ID; 53 54 public static final int V1_SOURCE_STAMP_BLOCK_ID = 55 SourceStampConstants.V1_SOURCE_STAMP_BLOCK_ID; 56 public static final int V2_SOURCE_STAMP_BLOCK_ID = 57 SourceStampConstants.V2_SOURCE_STAMP_BLOCK_ID; 58 59 public static final String OID_RSA_ENCRYPTION = "1.2.840.113549.1.1.1"; 60 } 61