I am trying to change the custom certificate handler for my Android build so it will accept the self-signed cert on my server. I have created a script that Extends Unity.Networking.CertificateHandler per the several examples floating around that accept a specific public key. My version looks like this:
using UnityEngine.Networking;
using System.Security.Cryptography.X509Certificates;
using UnityEngine;
// Based on https://www.owasp.org/index.php/Certificate_and_Public_Key_Pinning#.Net
class AcceptANGCertificate : CertificateHandler
{
// Encoded RSAPublicKey
private static string PUB_KEY = "blahblahblahkeyishere";
protected override bool ValidateCertificate(byte[] certificateData)
{
X509Certificate2 certificate = new X509Certificate2(certificateData);
string pk = certificate.GetPublicKeyString();
//Uncomment to find public key.
//Debug.Log(pk);
if (pk.ToLower().Equals(PUB_KEY.ToLower()))
return true;
return false;
}
}
However, when I try to assign this handler to the CustomCertificateHander field in the AddressablesSettings asset, the list is never populated. I’ve tried renaming my script, and upgrading the Addressable Package to the latest. I’m stumped.