what-the-bank/sources/org/bouncycastle/crypto/tls/CertificateStatusRequest.java

58 lines
1.8 KiB
Java

package org.bouncycastle.crypto.tls;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/* loaded from: classes6.dex */
public class CertificateStatusRequest {
protected Object request;
protected short statusType;
public short getStatusType() {
return this.statusType;
}
public Object getRequest() {
return this.request;
}
public OCSPStatusRequest getOCSPStatusRequest() {
if (isCorrectType((short) 1, this.request)) {
return (OCSPStatusRequest) this.request;
}
throw new IllegalStateException("'request' is not an OCSPStatusRequest");
}
public void encode(OutputStream outputStream) throws IOException {
TlsUtils.writeUint8(this.statusType, outputStream);
if (this.statusType != 1) {
throw new TlsFatalAlert((short) 80);
}
((OCSPStatusRequest) this.request).encode(outputStream);
}
public static CertificateStatusRequest parse(InputStream inputStream) throws IOException {
short readUint8 = TlsUtils.readUint8(inputStream);
if (readUint8 == 1) {
return new CertificateStatusRequest(readUint8, OCSPStatusRequest.parse(inputStream));
}
throw new TlsFatalAlert((short) 50);
}
protected static boolean isCorrectType(short s, Object obj) {
if (s == 1) {
return obj instanceof OCSPStatusRequest;
}
throw new IllegalArgumentException("'statusType' is an unsupported value");
}
public CertificateStatusRequest(short s, Object obj) {
if (!isCorrectType(s, obj)) {
throw new IllegalArgumentException("'request' is not an instance of the correct type");
}
this.statusType = s;
this.request = obj;
}
}