what-the-bank/sources/org/bouncycastle/asn1/DERSet.java

67 lines
2.1 KiB
Java

package org.bouncycastle.asn1;
import java.io.IOException;
import java.util.Enumeration;
/* loaded from: classes6.dex */
public class DERSet extends ASN1Set {
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.ASN1Set, org.bouncycastle.asn1.ASN1Primitive
public void encode(ASN1OutputStream aSN1OutputStream) throws IOException {
ASN1OutputStream dERSubStream = aSN1OutputStream.getDERSubStream();
int bodyLength = getBodyLength();
aSN1OutputStream.write(49);
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 DERSet(ASN1Encodable[] aSN1EncodableArr) {
super(aSN1EncodableArr, true);
this.bodyLength = -1;
}
/* JADX INFO: Access modifiers changed from: package-private */
public DERSet(ASN1EncodableVector aSN1EncodableVector, boolean z) {
super(aSN1EncodableVector, z);
this.bodyLength = -1;
}
public DERSet(ASN1EncodableVector aSN1EncodableVector) {
super(aSN1EncodableVector, true);
this.bodyLength = -1;
}
public DERSet(ASN1Encodable aSN1Encodable) {
super(aSN1Encodable);
this.bodyLength = -1;
}
public DERSet() {
this.bodyLength = -1;
}
}