locked
C# Jira API {"The request was aborted: Could not create SSL/TLS secure channel."} RRS feed

  • Question

  • Hi,

    I'm using VS - 2015 and developing an office plugin for Jira Service desk using their API's

    Since this is my first go at JSD API's, I have tried to keep things very simple.

    Goal - Authenticate and get the Queue data

    Error: {"The request was aborted: Could not create SSL/TLS secure channel."}

    My code so far...

    Reference 1

    Reference 2

    Ref 3

    string jsonResponse = null;
    
    urlJira = "https://projectName.net/rest/servicedeskapi/servicedesk/1000001";
    
    WebRequest requestIssueList = WebRequest.Create(urlJira) as HttpWebRequest;
    HttpWebResponse responseJiraList = null;
    requestIssueList.Method = "GET";
    requestIssueList.ContentType = "application/json";
    
    ServicePointManager.Expect100Continue = true;
    
    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12
    | SecurityProtocolType.Tls11
    | SecurityProtocolType.Tls
    | SecurityProtocolType.Ssl3;
    
    requestIssueList.Headers.Add("Authorization", "Basic " + GetEncodedCredentials(strUserName, apiToken));
    // byte[] data = Encoding.UTF8.GetBytes(JsonString);
    
    responseJiraList = (HttpWebResponse)requestIssueList.GetResponse();
    using (Stream stream = responseJiraList.GetResponseStream())
    {
    StreamReader str = new StreamReader(stream);
    jsonResponse = str.ReadToEnd();
    str.Close();
    }

    Any help is highly appreciated ...
    • Edited by StSingh Tuesday, October 27, 2020 8:19 AM
    Tuesday, October 27, 2020 8:17 AM

Answers

  • This is a standard error when your app isn't using TLS 1.2. Every secure service is now using TLS 1.2. If you're running on an older framework version then it may not use TLS 1.2. Microsoft has full documentation on how to determine whether you're impacted and, if so, what you need to change to fix it.

    Given you're creating an office addin you'll likely need to programmatically enable the TLS 1.2 protocol using the steps given.


    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, October 27, 2020 3:30 PM