/// <exception cref="System.IO.IOException"/> public virtual iText.Forms.Fields.PdfButtonFormField SetImage(String image) { Stream @is = new FileStream(image, FileMode.Open, FileAccess.Read); String str = System.Convert.ToBase64String(StreamUtil.InputStreamToArray(@is)); return((iText.Forms.Fields.PdfButtonFormField)SetValue(str)); }
public virtual void TestOtherLinesWithActualTextAddition02() { byte[] ttf = StreamUtil.InputStreamToArray(new FileStream(iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext .CurrentContext.TestDirectory) + "/resources/itext/io/font/otf/FreeSans.ttf", FileMode.Open, FileAccess.Read )); TrueTypeFont font = new TrueTypeFont(ttf); GlyphLine containerLine = new GlyphLine(ConstructGlyphListFromString("France", font)); containerLine.SetActualText(1, 5, "id"); GlyphLine childLine = new GlyphLine(ConstructGlyphListFromString("---Liberte", font)); childLine.SetActualText(3, 10, "Viva"); containerLine.Add(childLine); containerLine.end = 16; NUnit.Framework.Assert.IsNull(containerLine.actualText[0]); for (int i = 1; i < 5; i++) { NUnit.Framework.Assert.AreEqual("id", containerLine.actualText[i].value); } for (int i = 5; i < 9; i++) { NUnit.Framework.Assert.IsNull(containerLine.actualText[i]); } for (int i = 9; i < 16; i++) { NUnit.Framework.Assert.AreEqual("Viva", containerLine.actualText[i].value); } NUnit.Framework.Assert.AreEqual("Fide---Viva", containerLine.ToString()); }
public virtual void TestOtherLinesAddition() { byte[] ttf = StreamUtil.InputStreamToArray(new FileStream(iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext .CurrentContext.TestDirectory) + "/resources/itext/io/font/otf/FreeSans.ttf", FileMode.Open, FileAccess.Read )); TrueTypeFont font = new TrueTypeFont(ttf); GlyphLine containerLine = new GlyphLine(ConstructGlyphListFromString("Viva France!", font)); GlyphLine childLine1 = new GlyphLine(ConstructGlyphListFromString(" Liberte", font)); containerLine.Add(childLine1); NUnit.Framework.Assert.AreEqual(containerLine.end, 12); containerLine.end = 20; GlyphLine childLine2 = new GlyphLine(ConstructGlyphListFromString(" Egalite", font)); containerLine.Add(childLine2); NUnit.Framework.Assert.AreEqual(containerLine.end, 20); containerLine.start = 10; GlyphLine childLine3 = new GlyphLine(ConstructGlyphListFromString(" Fraternite", font)); containerLine.Add(childLine3); NUnit.Framework.Assert.AreEqual(containerLine.start, 10); containerLine.start = 0; containerLine.Add(ConstructGlyphListFromString("!", font)[0]); containerLine.end = 40; NUnit.Framework.Assert.AreEqual(containerLine.glyphs.Count, 40); }
public virtual void AttemptToSetNullIccProfileToImageTest() { using (FileStream fis = new FileStream(SOURCE_FOLDER + "WP_20140410_001.jpg", FileMode.Open, FileAccess.Read )) { byte[][] icc = new byte[][] { null, null }; ImageData img = ImageDataFactory.CreateJpeg(StreamUtil.InputStreamToArray(fis)); NUnit.Framework.Assert.DoesNotThrow(() => JpegImageHelper.AttemptToSetIccProfileToImage(icc, img)); } }
private String GetCssFileContents(String filePath) { byte[] bytes = StreamUtil.InputStreamToArray(new FileStream(filePath, FileMode.Open, FileAccess.Read)); String content = iText.IO.Util.JavaUtil.GetStringForBytes(bytes); content = content.Trim(); content = content.Replace("\r\n", "\n"); return(content); }
public virtual void TestReadingJbigFromBytes() { using (FileStream @is = new FileStream(SOURCE_FOLDER + "image.jb2", FileMode.Open, FileAccess.Read)) { byte[] inputImage = StreamUtil.InputStreamToArray(@is); ImageData imageData = ImageDataFactory.CreateJbig2(inputImage, 1); NUnit.Framework.Assert.AreEqual(100, (int)imageData.GetHeight()); NUnit.Framework.Assert.AreEqual(100, (int)imageData.GetWidth()); } }
/// <summary>Collects CSS declarationss.</summary> /// <param name="rootNode">the root node</param> /// <param name="resourceResolver">the resource resolver</param> /// <param name="cssContext">the CSS context</param> private void CollectCssDeclarations(INode rootNode, ResourceResolver resourceResolver, CssContext cssContext ) { cssStyleSheet = new CssStyleSheet(); LinkedList <INode> q = new LinkedList <INode>(); q.Add(rootNode); while (!q.IsEmpty()) { INode currentNode = q.JGetFirst(); q.RemoveFirst(); if (currentNode is IElementNode) { IElementNode headChildElement = (IElementNode)currentNode; if (TagConstants.STYLE.Equals(headChildElement.Name())) { if (currentNode.ChildNodes().Count > 0 && currentNode.ChildNodes()[0] is IDataNode) { String styleData = ((IDataNode)currentNode.ChildNodes()[0]).GetWholeData(); CheckIfPagesCounterMentioned(styleData, cssContext); CssStyleSheet styleSheet = CssStyleSheetParser.Parse(styleData); styleSheet = WrapStyleSheetInMediaQueryIfNecessary(headChildElement, styleSheet); cssStyleSheet.AppendCssStyleSheet(styleSheet); } } else { if (HtmlUtils.IsStyleSheetLink(headChildElement)) { String styleSheetUri = headChildElement.GetAttribute(AttributeConstants.HREF); try { Stream stream = resourceResolver.RetrieveStyleSheet(styleSheetUri); byte[] bytes = StreamUtil.InputStreamToArray(stream); CheckIfPagesCounterMentioned(iText.IO.Util.JavaUtil.GetStringForBytes(bytes, System.Text.Encoding.UTF8), cssContext ); CssStyleSheet styleSheet = CssStyleSheetParser.Parse(new MemoryStream(bytes), resourceResolver.ResolveAgainstBaseUri (styleSheetUri).ToExternalForm()); styleSheet = WrapStyleSheetInMediaQueryIfNecessary(headChildElement, styleSheet); cssStyleSheet.AppendCssStyleSheet(styleSheet); } catch (Exception exc) { ILog logger = LogManager.GetLogger(typeof(iText.Html2pdf.Css.Resolve.DefaultCssResolver)); logger.Error(iText.Html2pdf.LogMessageConstant.UNABLE_TO_PROCESS_EXTERNAL_CSS_FILE, exc); } } } } foreach (INode child in currentNode.ChildNodes()) { if (child is IElementNode) { q.Add(child); } } } }
public virtual void GifImageTest() { using (FileStream file = new FileStream(sourceFolder + "WP_20140410_001.gif", FileMode.Open, FileAccess.Read )) { byte[] fileContent = StreamUtil.InputStreamToArray(file); ImageData img = ImageDataFactory.Create(fileContent, false); NUnit.Framework.Assert.IsTrue(img.IsRawImage()); NUnit.Framework.Assert.AreEqual(ImageType.GIF, img.GetOriginalType()); } }
public byte[] Sign(Stream data) { ContentInfo content = new ContentInfo(StreamUtil.InputStreamToArray(data)); SignedCms signedCms = new SignedCms(content, true); CmsSigner signer = new CmsSigner(certificate); customization?.Invoke(signer); signer.IncludeOption = X509IncludeOption.WholeChain; signedCms.ComputeSignature(signer); return(signedCms.Encode()); }
public virtual void OpenJpeg3() { using (FileStream fis = new FileStream(sourceFolder + "WP_20140410_001_monochrome.jpg", FileMode.Open, FileAccess.Read )) { // Test this a more specific entry point ImageData img = ImageDataFactory.Create(StreamUtil.InputStreamToArray(fis)); NUnit.Framework.Assert.AreEqual(2592, img.GetWidth(), 0); NUnit.Framework.Assert.AreEqual(1456, img.GetHeight(), 0); NUnit.Framework.Assert.AreEqual(8, img.GetBpc()); } }
public virtual void OpenTiff1() { byte[] imageBytes = StreamUtil.InputStreamToArray(new FileStream(sourceFolder + "WP_20140410_001.tif", FileMode.Open , FileAccess.Read)); // Test a more specific entry point ImageData img = ImageDataFactory.CreateTiff(imageBytes, false, 1, false); NUnit.Framework.Assert.AreEqual(2592, img.GetWidth(), 0); NUnit.Framework.Assert.AreEqual(1456, img.GetHeight(), 0); NUnit.Framework.Assert.AreEqual(8, img.GetBpc()); }
public virtual void TestCreatingJbigFromCommonMethodByUrlAndBytesProducesSameResult() { String imageFilePath = SOURCE_FOLDER + "image.jb2"; ImageData imageDataFromUrl = ImageDataFactory.Create(UrlUtil.ToURL(imageFilePath)); using (FileStream fis = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read)) { byte[] imageBytes = StreamUtil.InputStreamToArray(fis); ImageData imageDataFromBytes = ImageDataFactory.Create(imageBytes); NUnit.Framework.Assert.AreEqual(imageDataFromBytes.GetData(), imageDataFromUrl.GetData()); } }
public virtual void TestActualTextForSubstitutedGlyphProcessingInSubstituteOneToMany03() { byte[] ttf = StreamUtil.InputStreamToArray(new FileStream(iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext .CurrentContext.TestDirectory) + "/resources/itext/io/font/otf/FreeSans.ttf", FileMode.Open, FileAccess.Read )); TrueTypeFont font = new TrueTypeFont(ttf); // no actual text is set GlyphLine line = new GlyphLine(ConstructGlyphListFromString("A", font)); line.SubstituteOneToMany(font.GetGsubTable(), new int[] { 39, 40 }); NUnit.Framework.Assert.IsNull(line.actualText); }
/// <summary>Gets default font as a byte array.</summary> /// <returns>default font as byte[]</returns> private byte[] GetDefaultFont() { try { using (Stream stream = ResourceUtil.GetResourceStream(DEFAULT_FONT_PATH)) { return(StreamUtil.InputStreamToArray(stream)); } } catch (System.IO.IOException e) { LogManager.GetLogger(GetType()).Error(MessageFormatUtil.Format(PdfOcrLogMessageConstant.CANNOT_READ_DEFAULT_FONT , e.Message)); return(new byte[0]); } }
public virtual void OpenBmp3() { String imageFileName = sourceFolder + "WP_20140410_001_monochrome.bmp"; using (FileStream fis = new FileStream(imageFileName, FileMode.Open, FileAccess.Read)) { byte[] imageBytes = StreamUtil.InputStreamToArray(fis); // Test this a more specific entry point ImageData img = ImageDataFactory.CreateBmp(imageBytes, false); NUnit.Framework.Assert.AreEqual(2592, img.GetWidth(), 0); NUnit.Framework.Assert.AreEqual(1456, img.GetHeight(), 0); NUnit.Framework.Assert.AreEqual(1, img.GetBpc()); } }
public virtual void GifImageSpecificFrameTest() { String imageFilePath = sourceFolder + "image-2frames.gif"; using (FileStream file = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read)) { byte[] fileContent = StreamUtil.InputStreamToArray(file); ImageData img = ImageDataFactory.CreateGifFrame(fileContent, 2); NUnit.Framework.Assert.AreEqual(100, (int)img.GetWidth()); NUnit.Framework.Assert.AreEqual(100, (int)img.GetHeight()); ImageData imgFromUrl = ImageDataFactory.CreateGifFrame(UrlUtil.ToURL(imageFilePath), 2); NUnit.Framework.Assert.AreEqual(img.GetData(), imgFromUrl.GetData()); } }
/// <summary> /// Retrieve a resource as a byte array from a source that /// can either be a link to a file, or a base64 encoded /// <see cref="System.String"/>. /// </summary> /// <param name="src">either link to file or base64 encoded stream.</param> /// <returns>byte[] on success, otherwise null.</returns> public virtual byte[] RetrieveBytesFromResource(String src) { try { using (Stream stream = RetrieveResourceAsInputStream(src)) { return((stream == null) ? null : StreamUtil.InputStreamToArray(stream)); } } catch (System.IO.IOException ioe) { logger.Error(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI , uriResolver.GetBaseUri(), src), ioe); return(null); } }
public virtual void GifImageReadingAllFramesTest() { String imageFilePath = sourceFolder + "image-2frames.gif"; using (FileStream file = new FileStream(imageFilePath, FileMode.Open, FileAccess.Read)) { byte[] fileContent = StreamUtil.InputStreamToArray(file); IList <ImageData> frames = ImageDataFactory.CreateGifFrames(fileContent); NUnit.Framework.Assert.AreEqual(2, frames.Count); NUnit.Framework.Assert.AreNotEqual(frames[0].GetData(), frames[1].GetData()); IList <ImageData> framesFromUrl = ImageDataFactory.CreateGifFrames(UrlUtil.ToURL(imageFilePath)); NUnit.Framework.Assert.AreEqual(frames[0].GetData(), framesFromUrl[0].GetData()); NUnit.Framework.Assert.AreEqual(frames[1].GetData(), framesFromUrl[1].GetData()); } }
public virtual void TestContentReplacingWithNullActualText() { byte[] ttf = StreamUtil.InputStreamToArray(new FileStream(iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext .CurrentContext.TestDirectory) + "/resources/itext/io/font/otf/FreeSans.ttf", FileMode.Open, FileAccess.Read )); TrueTypeFont font = new TrueTypeFont(ttf); GlyphLine lineToBeReplaced = new GlyphLine(ConstructGlyphListFromString("Byelorussia", font)); lineToBeReplaced.SetActualText(1, 2, "e"); GlyphLine lineToBeCopied = new GlyphLine(ConstructGlyphListFromString("Belarus", font)); lineToBeReplaced.ReplaceContent(lineToBeCopied); // Test that no exception has been thrown. Also check the content. NUnit.Framework.Assert.AreEqual("Belarus", lineToBeReplaced.ToString()); }
/// <summary>Adds the shipped free fonts.</summary> private void AddShippedFreeFonts(Range rangeToLoad) { foreach (String fontName in SHIPPED_FONT_NAMES) { try { using (Stream stream = ResourceUtil.GetResourceStream(SHIPPED_FONT_RESOURCE_PATH + fontName)) { byte[] fontProgramBytes = StreamUtil.InputStreamToArray(stream); AddFont(fontProgramBytes, null, rangeToLoad); } } catch (Exception) { LOGGER.Error(iText.Html2pdf.LogMessageConstant.ERROR_LOADING_FONT); } } }
public virtual void TestActualTextForSubstitutedGlyphProcessingInSubstituteOneToMany02() { String expectedActualTextForFirstGlyph = "A"; byte[] ttf = StreamUtil.InputStreamToArray(new FileStream(iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext .CurrentContext.TestDirectory) + "/resources/itext/io/font/otf/FreeSans.ttf", FileMode.Open, FileAccess.Read )); TrueTypeFont font = new TrueTypeFont(ttf); GlyphLine line = new GlyphLine(ConstructGlyphListFromString("A", font)); line.SetActualText(0, 1, expectedActualTextForFirstGlyph); line.SubstituteOneToMany(font.GetGsubTable(), new int[] { 39, 40 }); NUnit.Framework.Assert.IsNotNull(line.actualText); NUnit.Framework.Assert.AreEqual(2, line.actualText.Count); NUnit.Framework.Assert.AreSame(line.actualText[0], line.actualText[1]); NUnit.Framework.Assert.AreEqual(expectedActualTextForFirstGlyph, line.actualText[0].value); }
/// <summary> /// Creates a new /// <see cref="RandomAccessSource"/> /// by reading the specified file/resource into memory /// </summary> /// <param name="stream">the name of the resource to read</param> /// <returns> /// the newly created /// <see cref="RandomAccessSource"/> /// </returns> /// <exception cref="System.IO.IOException">if reading the underling file or stream fails /// </exception> private IRandomAccessSource CreateByReadingToMemory(Stream stream) { try { return(new ArrayRandomAccessSource(StreamUtil.InputStreamToArray(stream))); } finally { try { stream.Dispose(); } catch (System.IO.IOException) { } } }
/// <summary>Gets the byte array that are retrieved from the source URL.</summary> /// <param name="url">the source URL</param> /// <returns> /// the byte array or null if the retrieving failed or the /// URL was filtered or the resourceSizeByteLimit was violated /// </returns> public virtual byte[] GetByteArrayByUrl(Uri url) { try { using (Stream stream = GetInputStreamByUrl(url)) { if (stream == null) { return(null); } return(StreamUtil.InputStreamToArray(stream)); } } catch (ReadingByteLimitException) { logger.Warn(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.UNABLE_TO_RETRIEVE_RESOURCE_WITH_GIVEN_RESOURCE_SIZE_BYTE_LIMIT , url, resourceSizeByteLimit)); } return(null); }
public virtual void Test07() { String htmlFileName = sourceFolder + "html07.html"; byte[] bytes = StreamUtil.InputStreamToArray(new FileStream(htmlFileName, FileMode.Open, FileAccess.Read)); String html = iText.IO.Util.JavaUtil.GetStringForBytes(bytes); MediaDeviceDescription printDevice = new MediaDeviceDescription(MediaType.PRINT); MediaDeviceDescription screenDevice = new MediaDeviceDescription(MediaType.SCREEN).SetWidth(1000); IList <IElement> printElements = HtmlConverter.ConvertToElements(html, new ConverterProperties().SetMediaDeviceDescription (printDevice).SetBaseUri(sourceFolder)); IList <IElement> screenElements = HtmlConverter.ConvertToElements(html, new ConverterProperties().SetMediaDeviceDescription (screenDevice).SetBaseUri(sourceFolder)); NUnit.Framework.Assert.AreEqual(12f, printElements[0].GetProperty <UnitValue>(Property.FONT_SIZE).GetValue( ), 1e-10f); NUnit.Framework.Assert.AreEqual(20f, screenElements[0].GetProperty <UnitValue>(Property.FONT_SIZE).GetValue (), 1e-10f); }
public virtual void AttemptToSetInvalidIccProfileToImageTest() { using (FileStream fis = new FileStream(SOURCE_FOLDER + "WP_20140410_001.jpg", FileMode.Open, FileAccess.Read )) { ImageData img = ImageDataFactory.CreateJpeg(StreamUtil.InputStreamToArray(fis)); int size = 100; // Instantiate new byte[size][] instead new byte[size][size] necessary for autoporting byte[][] icc = new byte[size][]; for (int i = 0; i < size; i++) { icc[i] = new byte[size]; for (int j = 0; j < size; j++) { icc[i][j] = (byte)j; } } NUnit.Framework.Assert.DoesNotThrow(() => JpegImageHelper.AttemptToSetIccProfileToImage(icc, img)); } }
public virtual void TestAdditionWithActualText() { byte[] ttf = StreamUtil.InputStreamToArray(new FileStream(iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext .CurrentContext.TestDirectory) + "/resources/itext/io/font/otf/FreeSans.ttf", FileMode.Open, FileAccess.Read )); TrueTypeFont font = new TrueTypeFont(ttf); IList <Glyph> glyphs = ConstructGlyphListFromString("Viva France!", font); GlyphLine containerLine = new GlyphLine(glyphs); NUnit.Framework.Assert.IsNull(containerLine.actualText); containerLine.SetActualText(0, 1, "TEST"); NUnit.Framework.Assert.IsNotNull(containerLine.actualText); NUnit.Framework.Assert.AreEqual(12, containerLine.actualText.Count); NUnit.Framework.Assert.AreEqual("TEST", containerLine.actualText[0].value); containerLine.Add(new GlyphLine(glyphs)); NUnit.Framework.Assert.AreEqual(24, containerLine.actualText.Count); for (int i = 13; i < 24; i++) { NUnit.Framework.Assert.IsNull(containerLine.actualText[i]); } }
public virtual byte[] RetrieveStream(String src) { try { using (Stream stream = RetrieveResourceAsInputStream(src)) { if (stream != null) { return(StreamUtil.InputStreamToArray(stream)); } else { return(null); } } } catch (Exception e) { ILog logger = LogManager.GetLogger(typeof(iText.StyledXmlParser.Resolver.Resource.ResourceResolver)); logger.Error(MessageFormatUtil.Format(iText.StyledXmlParser.LogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI , uriResolver.GetBaseUri(), src), e); return(null); } }
public virtual void TestActualTextForSubstitutedGlyphProcessingInSubstituteOneToMany01() { String expectedActualTextForFirstGlyph = "0"; String expectedActualTextForSecondGlyph = "A"; byte[] ttf = StreamUtil.InputStreamToArray(new FileStream(iText.Test.TestUtil.GetParentProjectDirectory(NUnit.Framework.TestContext .CurrentContext.TestDirectory) + "/resources/itext/io/font/otf/FreeSans.ttf", FileMode.Open, FileAccess.Read )); TrueTypeFont font = new TrueTypeFont(ttf); // no actual text for the second glyph is set - it should be created during substitution GlyphLine line = new GlyphLine(ConstructGlyphListFromString("AA", font)); line.SetActualText(0, 1, expectedActualTextForFirstGlyph); line.idx = 1; line.SubstituteOneToMany(font.GetGsubTable(), new int[] { 39, 40 }); NUnit.Framework.Assert.IsNotNull(line.actualText); NUnit.Framework.Assert.AreEqual(3, line.actualText.Count); NUnit.Framework.Assert.AreSame(line.actualText[1], line.actualText[2]); NUnit.Framework.Assert.AreEqual(expectedActualTextForSecondGlyph, line.actualText[1].value); // check that it hasn't been corrupted NUnit.Framework.Assert.AreEqual(expectedActualTextForFirstGlyph, line.actualText[0].value); }
public virtual void SRGBImageTest() { using (FileStream fis = new FileStream(sourceFolder + "sRGBImage.png", FileMode.Open, FileAccess.Read)) { byte[] imageBytes = StreamUtil.InputStreamToArray(fis); // Test a more specific entry point ImageData img = ImageDataFactory.CreatePng(imageBytes); NUnit.Framework.Assert.AreEqual(ImageType.PNG, img.GetOriginalType()); NUnit.Framework.Assert.AreEqual(50, img.GetWidth(), 0); NUnit.Framework.Assert.AreEqual(50, img.GetHeight(), 0); NUnit.Framework.Assert.AreEqual(96, img.GetDpiX()); NUnit.Framework.Assert.AreEqual(96, img.GetDpiY()); NUnit.Framework.Assert.AreEqual(2.2, ((PngImageData)img).GetGamma(), 0.0001f); PngChromaticities pngChromaticities = ((PngImageData)img).GetPngChromaticities(); NUnit.Framework.Assert.AreEqual(0.3127f, pngChromaticities.GetXW(), 0.0001f); NUnit.Framework.Assert.AreEqual(0.329f, pngChromaticities.GetYW(), 0.0001f); NUnit.Framework.Assert.AreEqual(0.64f, pngChromaticities.GetXR(), 0.0001f); NUnit.Framework.Assert.AreEqual(0.33f, pngChromaticities.GetYR(), 0.0001f); NUnit.Framework.Assert.AreEqual(0.3f, pngChromaticities.GetXG(), 0.0001f); NUnit.Framework.Assert.AreEqual(0.6f, pngChromaticities.GetYG(), 0.0001f); NUnit.Framework.Assert.AreEqual(0.15f, pngChromaticities.GetXB(), 0.0001f); NUnit.Framework.Assert.AreEqual(0.06f, pngChromaticities.GetYB(), 0.0001f); } }
private OcspResp GetOcspResponse(X509Certificate checkCert, X509Certificate rootCert, String url) { if (checkCert == null || rootCert == null) { return(null); } if (url == null) { url = CertificateUtil.GetOCSPURL(checkCert); } if (url == null) { return(null); } LOGGER.Info("Getting OCSP from " + url); OcspReq request = GenerateOCSPRequest(rootCert, checkCert.SerialNumber); byte[] array = request.GetEncoded(); Uri urlt = new Uri(url); Stream @in = SignUtils.GetHttpResponseForOcspRequest(array, urlt); return(new OcspResp(StreamUtil.InputStreamToArray(@in))); }