Hi! I got a Unity Mono c# swagger client generated, so when I run the code 
over http; it runs fine, but if I run it over https, I get Error getting 
response stream (Write: The authentication or decryption has failed.): 
SendFailure

I try using certmgr.exe to add the certificate and also used the mozilla 
tools, but it doesnt work.
In stackoverflow they mentioned that in order to bypass the certificate I 
should use:

    void OnEnable()
    {
        Debug.Log("OnEnable********");

        ServicePointManager.ServerCertificateValidationCallback += 
MyRemoteCertificateValidationCallback;
    }
public static bool RemoteCertificateValidationCallback(object sender, 
X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors){
    UnityEngine.Debug.Log("MyRemoteCertificateValidationCallback");
    bool isOk = true;
    // If there are errors in the certificate chain, look at each error to 
determine the cause.
    if (sslPolicyErrors != SslPolicyErrors.None)
    {
        for (int i = 0; i < chain.ChainStatus.Length; i++)
        {
            if (chain.ChainStatus[i].Status != 
X509ChainStatusFlags.RevocationStatusUnknown)
            {
                chain.ChainPolicy.RevocationFlag = 
X509RevocationFlag.EntireChain;
                chain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
                chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0);
                chain.ChainPolicy.VerificationFlags = 
X509VerificationFlags.AllFlags;
                bool chainIsValid = chain.Build((X509Certificate2)certificate);
                if (!chainIsValid)
                {
                    isOk = false;
                }
            }
        }
    }
    return isOk;}

, but it doesnt work. and the callback never gets called. How do you make 
swagger be able to run in https?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to