• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.apksig.internal.x509;
18 
19 import com.android.apksig.internal.asn1.Asn1Class;
20 import com.android.apksig.internal.asn1.Asn1Field;
21 import com.android.apksig.internal.asn1.Asn1Type;
22 import com.android.apksig.internal.asn1.Asn1Tagging;
23 import com.android.apksig.internal.pkcs7.AlgorithmIdentifier;
24 
25 import java.math.BigInteger;
26 import java.nio.ByteBuffer;
27 import java.util.List;
28 
29 /**
30  * To Be Signed Certificate as specified in RFC 5280.
31  */
32 @Asn1Class(type = Asn1Type.SEQUENCE)
33 public class TBSCertificate {
34 
35     @Asn1Field(
36             index = 0,
37             type = Asn1Type.INTEGER,
38             tagging = Asn1Tagging.EXPLICIT, tagNumber = 0)
39     public int version;
40 
41     @Asn1Field(index = 1, type = Asn1Type.INTEGER)
42     public BigInteger serialNumber;
43 
44     @Asn1Field(index = 2, type = Asn1Type.SEQUENCE)
45     public AlgorithmIdentifier signatureAlgorithm;
46 
47     @Asn1Field(index = 3, type = Asn1Type.CHOICE)
48     public Name issuer;
49 
50     @Asn1Field(index = 4, type = Asn1Type.SEQUENCE)
51     public Validity validity;
52 
53     @Asn1Field(index = 5, type = Asn1Type.CHOICE)
54     public Name subject;
55 
56     @Asn1Field(index = 6, type = Asn1Type.SEQUENCE)
57     public SubjectPublicKeyInfo subjectPublicKeyInfo;
58 
59     @Asn1Field(index = 7,
60             type = Asn1Type.BIT_STRING,
61             tagging = Asn1Tagging.IMPLICIT,
62             optional = true,
63             tagNumber = 1)
64     public ByteBuffer issuerUniqueID;
65 
66     @Asn1Field(index = 8,
67             type = Asn1Type.BIT_STRING,
68             tagging = Asn1Tagging.IMPLICIT,
69             optional = true,
70             tagNumber = 2)
71     public ByteBuffer subjectUniqueID;
72 
73     @Asn1Field(index = 9,
74             type = Asn1Type.SEQUENCE_OF,
75             tagging = Asn1Tagging.EXPLICIT,
76             optional = true,
77             tagNumber = 3)
78     public List<Extension> extensions;
79 }
80