Certificate with "<%" cannot be regocnized in IIS

Chu, Ling Rui 1 Reputation point
2022-09-15T09:00:11.703+00:00

Hello,

Currently we put a certificate into an IIS and try to download it by Invoke-WebRequest.
The download failed and turns out to be due to the certificate contains "<%". 241412-image.png

Manually read by http also failed with 500:
241386-image.png

Other certificate without this "<%" can be downloaded.
Any suggestion on this issue?

Thanks in advance.

Chu Ling Rui

Internet Information Services
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,724 questions
{count} votes

4 answers

Sort by: Oldest
  1. Chu, Ling Rui 1 Reputation point
    2022-09-15T10:31:33.037+00:00

    Just an update:
    If we regenerate a certificate on the same system, certificate with <% will still be generated.
    241379-image.png

    0 comments No comments

  2. Chu, Ling Rui 1 Reputation point
    2022-09-16T06:24:06.71+00:00

    Hello,

    This 3C 25 is static IP on the site, no way to change it.
    Any good way to fix this issue?

    Thanks in advance.
    ChuLingRui

    0 comments No comments

  3. Limitless Technology 43,941 Reputation points
    2022-09-16T09:00:50.907+00:00

    Hello there,

    The first thing that has to be checked is whether the website is accessible over http. You will need to have the website working on http first before continuing with this troubleshooter.

    There could be many reasons. We will follow a step-by-step approach to solve this problem.

    Troubleshooting SSL related issues (Server Certificate) https://learn.microsoft.com/en-us/iis/troubleshoot/security-issues/troubleshooting-ssl-related-issues-server-certificate

    ---------------------------------------------------------------------------------------------------------------------------------------

    --If the reply is helpful, please Upvote and Accept it as an answer--


  4. MotoX80 31,581 Reputation points
    2022-09-16T12:43:45.097+00:00

    The problem is that IIS's default handler mapping for .cer files is asp.dll. IIS is trying to "run" your cer file. You need to have .cer files treated as a StaticFile.

    At the web site level, rename .cer to .cer-save or something like that.

    241865-image.png

    Then in the mime type definitions, add an entry for .cer files for application/octet-stream.

    241932-image.png

    Note: I don't know why the default IIS config is defined like that. Do this on a test server first to verify that it doesn't impact HTTPS sites.

    PS C:\> Invoke-WebRequest localhost/test.cer  
      
      
    StatusCode        : 200  
    StatusDescription : OK  
    Content           : {60, 37, 32, 32...}  
    RawContent        : HTTP/1.1 200 OK  
                        Accept-Ranges: bytes  
                        Content-Length: 343  
                        Content-Type: application/octet-stream  
                        Date: Fri, 16 Sep 2022 13:06:47 GMT  
                        ETag: "6d1e2cb1c2c9d81:0"  
                        Last-Modified: Fri, 16 Sep 2022 11:5...  
    Headers           : {[Accept-Ranges, bytes], [Content-Length, 343], [Content-Type, application/octet-stream], [Date,  
                        Fri, 16 Sep 2022 13:06:47 GMT]...}  
    RawContentLength  : 343  
      
    
    1 person found this answer helpful.