diff options
author | Neil Fuller <nfuller@google.com> | 2018-07-12 15:58:48 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2018-09-18 18:32:55 +0100 |
commit | 6a4a86b302cfc63e6917aef1f6937dae90646571 (patch) | |
tree | 2a196f81315b1fdd1d2bd5535a4a8846e5d36e9a /android_bcprov/src/main/java/com/android/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java | |
parent | 8ac7044ca44505764fdc9fa4e96fe79c11a2736a (diff) | |
download | bouncycastle-6a4a86b302cfc63e6917aef1f6937dae90646571.tar.gz |
Use generated source not jarjar
This commit switches to generating source code for
com.android.org.bouncycastle used on Android devices rather than relying
on jajar to repackage the bytecode.
Source code can (and must) be regenerated using scripts in
external/bouncycastle/srcgen when changes are made to bouncycastle
source code.
Having source code for the Android internal bouncycastle is being done
to enable the code to be included in stubs for system and other internal
API surfaces: the stubs generation relies on having source (which can be
annotated, or just have associated API metadata).
Test: build
Test: CtsLibcoreTestCases
Bug: 111055375
Bug: 111734251
Change-Id: I6d21774088e73c936e99059a9a0f071080174015
Diffstat (limited to 'android_bcprov/src/main/java/com/android/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java')
-rw-r--r-- | android_bcprov/src/main/java/com/android/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/android_bcprov/src/main/java/com/android/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java b/android_bcprov/src/main/java/com/android/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java new file mode 100644 index 00000000..c30dba68 --- /dev/null +++ b/android_bcprov/src/main/java/com/android/org/bouncycastle/asn1/x509/AttCertValidityPeriod.java @@ -0,0 +1,85 @@ +/* GENERATED SOURCE. DO NOT MODIFY. */ +package com.android.org.bouncycastle.asn1.x509; + +import com.android.org.bouncycastle.asn1.ASN1EncodableVector; +import com.android.org.bouncycastle.asn1.ASN1GeneralizedTime; +import com.android.org.bouncycastle.asn1.ASN1Object; +import com.android.org.bouncycastle.asn1.ASN1Primitive; +import com.android.org.bouncycastle.asn1.ASN1Sequence; +import com.android.org.bouncycastle.asn1.DERSequence; + +public class AttCertValidityPeriod + extends ASN1Object +{ + ASN1GeneralizedTime notBeforeTime; + ASN1GeneralizedTime notAfterTime; + + public static AttCertValidityPeriod getInstance( + Object obj) + { + if (obj instanceof AttCertValidityPeriod) + { + return (AttCertValidityPeriod)obj; + } + else if (obj != null) + { + return new AttCertValidityPeriod(ASN1Sequence.getInstance(obj)); + } + + return null; + } + + private AttCertValidityPeriod( + ASN1Sequence seq) + { + if (seq.size() != 2) + { + throw new IllegalArgumentException("Bad sequence size: " + + seq.size()); + } + + notBeforeTime = ASN1GeneralizedTime.getInstance(seq.getObjectAt(0)); + notAfterTime = ASN1GeneralizedTime.getInstance(seq.getObjectAt(1)); + } + + /** + * @param notBeforeTime + * @param notAfterTime + */ + public AttCertValidityPeriod( + ASN1GeneralizedTime notBeforeTime, + ASN1GeneralizedTime notAfterTime) + { + this.notBeforeTime = notBeforeTime; + this.notAfterTime = notAfterTime; + } + + public ASN1GeneralizedTime getNotBeforeTime() + { + return notBeforeTime; + } + + public ASN1GeneralizedTime getNotAfterTime() + { + return notAfterTime; + } + + /** + * Produce an object suitable for an ASN1OutputStream. + * <pre> + * AttCertValidityPeriod ::= SEQUENCE { + * notBeforeTime GeneralizedTime, + * notAfterTime GeneralizedTime + * } + * </pre> + */ + public ASN1Primitive toASN1Primitive() + { + ASN1EncodableVector v = new ASN1EncodableVector(); + + v.add(notBeforeTime); + v.add(notAfterTime); + + return new DERSequence(v); + } +} |