package org.bouncycastle.asn1; import java.io.IOException; /* loaded from: classes6.dex */ public class DERExternalParser implements ASN1Encodable, InMemoryRepresentable { private ASN1StreamParser _parser; @Override // org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { try { return getLoadedObject(); } catch (IOException e) { throw new ASN1ParsingException("unable to get DER object", e); } catch (IllegalArgumentException e2) { throw new ASN1ParsingException("unable to get DER object", e2); } } public ASN1Encodable readObject() throws IOException { return this._parser.readObject(); } @Override // org.bouncycastle.asn1.InMemoryRepresentable public ASN1Primitive getLoadedObject() throws IOException { try { return new DERExternal(this._parser.readVector()); } catch (IllegalArgumentException e) { throw new ASN1Exception(e.getMessage(), e); } } public DERExternalParser(ASN1StreamParser aSN1StreamParser) { this._parser = aSN1StreamParser; } }