void AddJohnAppleseedCertificateToTrustedCertificates(Context ctx) { try { var keystoreFile = ctx.Assets.Open("JohnAppleseed.p12"); // Inside a p12 we have both the certificate and private key used for signing. We just need the certificate here. // Proper signatures should have a root CA approved certificate making this step unnecessary. var key = SignatureManager.LoadPrivateKeyPairFromStream(keystoreFile, "test", null, null); if (key.Certificate.Type == "X.509") { SignatureManager.AddTrustedCertificate(key.Certificate.JavaCast <X509Certificate> ()); } } catch { AndHUD.Shared.ShowError(ctx, "Couldn't load and add John Appleseed certificate to trusted certificate list!", timeout: TimeSpan.FromSeconds(2)); } }