61 lines
1.9 KiB
Java
61 lines
1.9 KiB
Java
package org.bouncycastle.asn1;
|
|
|
|
import java.io.IOException;
|
|
import java.util.Enumeration;
|
|
|
|
/* loaded from: classes6.dex */
|
|
public class DERSequence extends ASN1Sequence {
|
|
private int bodyLength;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // org.bouncycastle.asn1.ASN1Primitive
|
|
public int encodedLength() throws IOException {
|
|
int bodyLength = getBodyLength();
|
|
return StreamUtil.calculateBodyLength(bodyLength) + 1 + bodyLength;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@Override // org.bouncycastle.asn1.ASN1Sequence, org.bouncycastle.asn1.ASN1Primitive
|
|
public void encode(ASN1OutputStream aSN1OutputStream) throws IOException {
|
|
ASN1OutputStream dERSubStream = aSN1OutputStream.getDERSubStream();
|
|
int bodyLength = getBodyLength();
|
|
aSN1OutputStream.write(48);
|
|
aSN1OutputStream.writeLength(bodyLength);
|
|
Enumeration objects = getObjects();
|
|
while (objects.hasMoreElements()) {
|
|
dERSubStream.writeObject((ASN1Encodable) objects.nextElement());
|
|
}
|
|
}
|
|
|
|
private int getBodyLength() throws IOException {
|
|
if (this.bodyLength < 0) {
|
|
Enumeration objects = getObjects();
|
|
int i = 0;
|
|
while (objects.hasMoreElements()) {
|
|
i += ((ASN1Encodable) objects.nextElement()).toASN1Primitive().toDERObject().encodedLength();
|
|
}
|
|
this.bodyLength = i;
|
|
}
|
|
return this.bodyLength;
|
|
}
|
|
|
|
public DERSequence(ASN1Encodable[] aSN1EncodableArr) {
|
|
super(aSN1EncodableArr);
|
|
this.bodyLength = -1;
|
|
}
|
|
|
|
public DERSequence(ASN1EncodableVector aSN1EncodableVector) {
|
|
super(aSN1EncodableVector);
|
|
this.bodyLength = -1;
|
|
}
|
|
|
|
public DERSequence(ASN1Encodable aSN1Encodable) {
|
|
super(aSN1Encodable);
|
|
this.bodyLength = -1;
|
|
}
|
|
|
|
public DERSequence() {
|
|
this.bodyLength = -1;
|
|
}
|
|
}
|