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.internal.apk.v3; 18 19 import com.android.apksig.internal.util.AndroidSdkVersion; 20 21 /** Constants used by the V3 Signature Scheme signing and verification. */ 22 public class V3SchemeConstants { V3SchemeConstants()23 private V3SchemeConstants() {} 24 25 public static final int APK_SIGNATURE_SCHEME_V3_BLOCK_ID = 0xf05368c0; 26 public static final int APK_SIGNATURE_SCHEME_V31_BLOCK_ID = 0x1b93ad61; 27 public static final int PROOF_OF_ROTATION_ATTR_ID = 0x3ba06f8c; 28 29 public static final int MIN_SDK_WITH_V3_SUPPORT = AndroidSdkVersion.P; 30 public static final int MIN_SDK_WITH_V31_SUPPORT = AndroidSdkVersion.T; 31 /** 32 * By default, APK signing key rotation will target T, but packages that have previously 33 * rotated can continue rotating on pre-T by specifying an SDK version <= 32 as the 34 * --rotation-min-sdk-version parameter when using apksigner or when invoking 35 * {@link com.android.apksig.ApkSigner.Builder#setMinSdkVersionForRotation(int)}. 36 */ 37 public static final int DEFAULT_ROTATION_MIN_SDK_VERSION = AndroidSdkVersion.T; 38 39 /** 40 * This attribute is intended to be written to the V3.0 signer block as an additional attribute 41 * whose value is the minimum SDK version supported for rotation by the V3.1 signing block. If 42 * this value is set to X and a v3.1 signing block does not exist, or the minimum SDK version 43 * for rotation in the v3.1 signing block is not X, then the APK should be rejected. 44 */ 45 public static final int ROTATION_MIN_SDK_VERSION_ATTR_ID = 0x559f8b02; 46 47 /** 48 * This attribute is written to the V3.1 signer block as an additional attribute to signify that 49 * the rotation-min-sdk-version is targeting a development release. This is required to support 50 * testing rotation on new development releases as the previous platform release SDK version 51 * is used as the development release SDK version until the development release SDK is 52 * finalized. 53 */ 54 public static final int ROTATION_ON_DEV_RELEASE_ATTR_ID = 0xc2a6b3ba; 55 } 56