public byte[] GetContent(ICipherParameters key) { try { return(CmsUtilities.StreamToByteArray(GetContentStream(key).ContentStream)); } catch (IOException arg) { throw new Exception("unable to parse internal stream: " + arg); } }
public byte[] GetContent(int limit) { CompressedData instance = CompressedData.GetInstance(contentInfo.Content); ContentInfo encapContentInfo = instance.EncapContentInfo; Asn1OctetString asn1OctetString = (Asn1OctetString)encapContentInfo.Content; ZInputStream inStream = new ZInputStream(new MemoryStream(asn1OctetString.GetOctets(), writable: false)); try { return(CmsUtilities.StreamToByteArray(inStream, limit)); } catch (IOException e) { throw new CmsException("exception reading compressed stream.", e); } }
public byte[] GetContent() { CompressedData instance = CompressedData.GetInstance(contentInfo.Content); ContentInfo encapContentInfo = instance.EncapContentInfo; Asn1OctetString asn1OctetString = (Asn1OctetString)encapContentInfo.Content; ZInputStream zInputStream = new ZInputStream(asn1OctetString.GetOctetStream()); try { return(CmsUtilities.StreamToByteArray(zInputStream)); } catch (IOException e) { throw new CmsException("exception reading compressed stream.", e); } finally { Platform.Dispose(zInputStream); } }