Пример #1
0
 public byte[] GetContent(ICipherParameters key)
 {
     try
     {
         return(CmsUtilities.StreamToByteArray(GetContentStream(key).ContentStream));
     }
     catch (IOException arg)
     {
         throw new Exception("unable to parse internal stream: " + arg);
     }
 }
Пример #2
0
    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);
        }
    }
Пример #3
0
    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);
        }
    }