示例#1
0
        byte[] ExportPkcs12(string password)
        {
            var pfx = new MX.PKCS12();

            try {
                var attrs      = new Hashtable();
                var localKeyId = new ArrayList();
                localKeyId.Add(new byte[] { 1, 0, 0, 0 });
                attrs.Add(MX.PKCS9.localKeyId, localKeyId);
                if (password != null)
                {
                    pfx.Password = password;
                }
                pfx.AddCertificate(new MX.X509Certificate(GetRawCertData()), attrs);
                if (IntermediateCertificates != null)
                {
                    for (int i = 0; i < IntermediateCertificates.Count; i++)
                    {
                        pfx.AddCertificate(new MX.X509Certificate(IntermediateCertificates [i].GetRawCertData()));
                    }
                }
                var privateKey = PrivateKey;
                if (privateKey != null)
                {
                    pfx.AddPkcs8ShroudedKeyBag(privateKey, attrs);
                }
                return(pfx.GetBytes());
            } finally {
                pfx.Password = null;
            }
        }
示例#2
0
        byte[] ExportPkcs12(string password)
        {
            var pfx = new MX.PKCS12();

            try {
                var attrs      = new Hashtable();
                var localKeyId = new ArrayList();
                localKeyId.Add(new byte[] { 1, 0, 0, 0 });
                attrs.Add(MX.PKCS9.localKeyId, localKeyId);

                if (password != null)
                {
                    pfx.Password = password;
                }
                pfx.AddCertificate(_cert, attrs);
                var privateKey = PrivateKey;
                if (privateKey != null)
                {
                    pfx.AddPkcs8ShroudedKeyBag(privateKey, attrs);
                }
                return(pfx.GetBytes());
            } finally {
                pfx.Password = null;
            }
        }
示例#3
0
        byte[] ExportPkcs12(string password)
        {
            var pfx = new MX.PKCS12();

            try {
                if (password != null)
                {
                    pfx.Password = password;
                }
                pfx.AddCertificate(_cert);
                var privateKey = PrivateKey;
                if (privateKey != null)
                {
                    pfx.AddPkcs8ShroudedKeyBag(privateKey);
                }
                return(pfx.GetBytes());
            } finally {
                pfx.Password = null;
            }
        }
示例#4
0
		byte[] ExportPkcs12 (string password)
		{
			var pfx = new MX.PKCS12 ();
			try {
				var attrs = new Hashtable ();
				var localKeyId = new ArrayList ();
				localKeyId.Add (new byte[] { 1, 0, 0, 0 });
				attrs.Add (MX.PKCS9.localKeyId, localKeyId);
				if (password != null)
					pfx.Password = password;
				pfx.AddCertificate (new MX.X509Certificate (GetRawCertData ()), attrs);
				if (IntermediateCertificates != null) {
					for (int i = 0; i < IntermediateCertificates.Count; i++)
						pfx.AddCertificate (new MX.X509Certificate (IntermediateCertificates [i].GetRawCertData ()));
				}
				var privateKey = PrivateKey;
				if (privateKey != null)
					pfx.AddPkcs8ShroudedKeyBag (privateKey, attrs);
				return pfx.GetBytes ();
			} finally {
				pfx.Password = null;
			}
		}
		byte[] ExportPkcs12 (string password)
		{
			var pfx = new MX.PKCS12 ();
			try {
				var attrs = new Hashtable ();
				var localKeyId = new ArrayList ();
				localKeyId.Add (new byte[] { 1, 0, 0, 0 });
				attrs.Add (MX.PKCS9.localKeyId, localKeyId);

				if (password != null)
					pfx.Password = password;
				pfx.AddCertificate (_cert, attrs);
				var privateKey = PrivateKey;
				if (privateKey != null)
					pfx.AddPkcs8ShroudedKeyBag (privateKey, attrs);
				return pfx.GetBytes ();
			} finally {
				pfx.Password = null;
			}
		}
示例#6
0
		byte[] ExportPkcs12 (string password)
		{
			var pfx = new MX.PKCS12 ();
			try {
				if (password != null)
					pfx.Password = password;
				pfx.AddCertificate (_cert);
				var privateKey = PrivateKey;
				if (privateKey != null)
					pfx.AddPkcs8ShroudedKeyBag (privateKey);
				return pfx.GetBytes ();
			} finally {
				pfx.Password = null;
			}
		}