Esempio n. 1
0
        public void CopyWithPrivateKeyForSsl_ThrowsOnNull()
        {
            var pairingRecord = PairingRecord.Read(File.ReadAllBytes("Lockdown/0123456789abcdef0123456789abcdef01234567.plist"));

            Assert.Throws <ArgumentNullException>(() => X509Certificate2Extensions.CopyWithPrivateKeyForSsl(pairingRecord.HostCertificate, null));
            Assert.Throws <ArgumentNullException>(() => X509Certificate2Extensions.CopyWithPrivateKeyForSsl(null, pairingRecord.HostPrivateKey));
        }
        public void TestArgumentExceptions()
        {
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.AsX509Certificate2(null));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetIssuerNameInfo(null, X509Name.CN));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetSubjectNameInfo(null, X509Name.CN));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetCommonName(null));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetSubjectName(null));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetSubjectEmailAddress(null));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetFingerprint(null));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetKeyUsageFlags((X509Certificate)null));
            Assert.Throws <ArgumentNullException> (() => BouncyCastleCertificateExtensions.GetEncryptionAlgorithms(null));

            Assert.Throws <ArgumentNullException> (() => X509Certificate2Extensions.AsBouncyCastleCertificate(null));
            Assert.Throws <ArgumentNullException> (() => X509Certificate2Extensions.GetEncryptionAlgorithms(null));
        }