1/*
2 * Copyright (C) 2018 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
17package com.android.internal.telephony.uicc.euicc;
18
19/**
20 * ASN1 tags used by {@link EuiccCard} implementation.
21 */
22class Tags {
23    // ASN.1 tags for commands
24    static final int TAG_GET_PROFILES = 0xBF2D;
25    static final int TAG_DISABLE_PROFILE = 0xBF32;
26    static final int TAG_ENABLE_PROFILE = 0xBF31;
27    static final int TAG_GET_EID = 0xBF3E;
28    static final int TAG_SET_NICKNAME = 0xBF29;
29    static final int TAG_DELETE_PROFILE = 0xBF33;
30    static final int TAG_GET_CONFIGURED_ADDRESSES = 0xBF3C;
31    static final int TAG_SET_DEFAULT_SMDP_ADDRESS = 0xBF3F;
32    static final int TAG_GET_RAT = 0xBF43;
33    static final int TAG_EUICC_MEMORY_RESET = 0xBF34;
34    static final int TAG_GET_EUICC_CHALLENGE = 0xBF2E;
35    static final int TAG_GET_EUICC_INFO_1 = 0xBF20;
36    static final int TAG_GET_EUICC_INFO_2 = 0xBF22;
37    static final int TAG_LIST_NOTIFICATION = 0xBF28;
38    static final int TAG_RETRIEVE_NOTIFICATIONS_LIST = 0xBF2B;
39    static final int TAG_REMOVE_NOTIFICATION_FROM_LIST = 0xBF30;
40    static final int TAG_AUTHENTICATE_SERVER = 0xBF38;
41    static final int TAG_PREPARE_DOWNLOAD = 0xBF21;
42    static final int TAG_INITIALISE_SECURE_CHANNEL = 0xBF23;
43
44    // Universal tags
45    static final int TAG_UNI_2 = 0x02;
46    static final int TAG_UNI_4 = 0x04;
47    // Context tags for primitive types
48    static final int TAG_CTX_0 = 0x80;
49    static final int TAG_CTX_1 = 0x81;
50    static final int TAG_CTX_2 = 0x82;
51    static final int TAG_CTX_3 = 0x83;
52    static final int TAG_CTX_4 = 0x84;
53    static final int TAG_CTX_5 = 0x85;
54    static final int TAG_CTX_6 = 0x86;
55    static final int TAG_CTX_7 = 0x87;
56    static final int TAG_CTX_8 = 0x88;
57    // Context tags for constructed (compound) types
58    static final int TAG_CTX_COMP_0 = 0xA0;
59    static final int TAG_CTX_COMP_1 = 0xA1;
60    static final int TAG_CTX_COMP_2 = 0xA2;
61    static final int TAG_CTX_COMP_3 = 0xA3;
62
63    // Command data tags
64    static final int TAG_PROFILE_INSTALLATION_RESULT = 0xBF37;
65    static final int TAG_PROFILE_INSTALLATION_RESULT_DATA = 0xBF27;
66    static final int TAG_NOTIFICATION_METADATA = 0xBF2F;
67    static final int TAG_SEQ = TAG_CTX_0;
68    static final int TAG_TARGET_ADDR = 0x0C;
69    static final int TAG_EVENT = TAG_CTX_1;
70    static final int TAG_CANCEL_SESSION = 0xBF41;
71    static final int TAG_PROFILE_INFO = 0xE3;
72    static final int TAG_TAG_LIST = 0x5C;
73    static final int TAG_EID = 0x5A;
74    static final int TAG_NICKNAME = 0x90;
75    static final int TAG_ICCID = 0x5A;
76    static final int TAG_PROFILE_STATE = 0x9F70;
77    static final int TAG_SERVICE_PROVIDER_NAME = 0x91;
78    static final int TAG_PROFILE_CLASS = 0x95;
79    static final int TAG_PROFILE_POLICY_RULE = 0x99;
80    static final int TAG_PROFILE_NAME = 0x92;
81    static final int TAG_OPERATOR_ID = 0xB7;
82    static final int TAG_CARRIER_PRIVILEGE_RULES = 0xBF76;
83
84    // Tags from the RefArDo data standard - https://source.android.com/devices/tech/config/uicc
85    static final int TAG_REF_AR_DO = 0xE2;
86    static final int TAG_REF_DO = 0xE1;
87    static final int TAG_DEVICE_APP_ID_REF_DO = 0xC1;
88    static final int TAG_PKG_REF_DO = 0xCA;
89    static final int TAG_AR_DO = 0xE3;
90    static final int TAG_PERM_AR_DO = 0xDB;
91
92    // TAG list for Euicc Profile
93    static final byte[] EUICC_PROFILE_TAGS = new byte[] {
94            TAG_ICCID,
95            (byte) TAG_NICKNAME,
96            (byte) TAG_SERVICE_PROVIDER_NAME,
97            (byte) TAG_PROFILE_NAME,
98            (byte) TAG_OPERATOR_ID,
99            (byte) (TAG_PROFILE_STATE / 256),
100            (byte) (TAG_PROFILE_STATE % 256),
101            (byte) TAG_PROFILE_CLASS,
102            (byte) TAG_PROFILE_POLICY_RULE,
103            (byte) (TAG_CARRIER_PRIVILEGE_RULES / 256),
104            (byte) (TAG_CARRIER_PRIVILEGE_RULES % 256),
105    };
106
107    private Tags() {}
108}
109