How can I skip ssl certificate verification on HTTPS connection using the OpenEdge.Net Libraries?

1.5k views Asked by At

I am trying to to do a POST to an API endpoint using Openedge. I have installed the ssl certificate of the place i am requesting from but the https request fails, telling me it can't find the ssl certificate of that place (in my /usr/dlc/certs).

"_errors": [
    {
        "_errorMsg": "ERROR condition: Secure Socket Layer (SSL) failure. error code -54:  unable to get local issuer certificate: for 85cf5865.0 in /usr/dlc/certs (9318) (7211)",
        "_errorNum": 9318
    }
]

So, i have resorted to doing an insecure request, like curl does it with the --insecure or wget does it with "no-check-certificate"

I am using the OpenEdge.Net Libraries on OpenEdge 11.6

creds = new Credentials('https://xxxx.com', 'usersname', 'password').
oPayload = NEW JsonObject().
oRequestBody = new String('CustomerReference=xxx&NoOfParcelsToAdd=2'). 

oRequest = RequestBuilder:Post('https://xxxxx.com/endpoint', oRequestBody)// Add credentials to the request 
        :UsingBasicAuthentication(creds) 
        :ContentType('application/x-www-form-urlencoded') 
        :AcceptJson() :Request.

    oResponse = ClientBuilder:Build():Client:Execute(oRequest).

I want to know, for this OpenEdge.Net Libraries is there a tag that i can put in order to skip the checking of the certificate?

2

There are 2 answers

1
Tom Bascom On

I don't know of any option to skip verification but I do know that a common source of that error is that your certificate authority is not in $DLC/certs. The default list of certificate authorities is fairly narrow.

1
Hombreliga On
USING OpenEdge.Net.HTTP.IHttpClientLibrary.

USING OpenEdge.Net.HTTP.Lib.ClientLibraryBuilder. 
 
DEFINE VARIABLE oLib AS IHttpClientLibrary NO-UNDO. 

oLib = ClientLibraryBuilder:Build()
        :sslVerifyHost(NO)
        :Library.

oHttpClient = ClientBuilder:Build()
              :UsingLibrary(oLib)
              :Client.