package org.bouncycastle.asn1; import java.io.IOException; import java.io.InputStream; /* loaded from: classes6.dex */ public class DEROctetStringParser implements ASN1OctetStringParser { private DefiniteLengthInputStream stream; @Override // org.bouncycastle.asn1.ASN1Encodable public ASN1Primitive toASN1Primitive() { try { return getLoadedObject(); } catch (IOException e) { StringBuilder sb = new StringBuilder("IOException converting stream to byte array: "); sb.append(e.getMessage()); throw new ASN1ParsingException(sb.toString(), e); } } @Override // org.bouncycastle.asn1.ASN1OctetStringParser public InputStream getOctetStream() { return this.stream; } @Override // org.bouncycastle.asn1.InMemoryRepresentable public ASN1Primitive getLoadedObject() throws IOException { return new DEROctetString(this.stream.toByteArray()); } /* JADX INFO: Access modifiers changed from: package-private */ public DEROctetStringParser(DefiniteLengthInputStream definiteLengthInputStream) { this.stream = definiteLengthInputStream; } }