GetAttributes() публичный Метод

public GetAttributes ( AsymmetricAlgorithm aa ) : IDictionary
aa System.Security.Cryptography.AsymmetricAlgorithm
Результат IDictionary
Пример #1
0
		public void GetAttributes_Test2 ()
		{
			PKCS12 p12 = new PKCS12 ();
			X509Certificate x509 = new X509Certificate (cert);

			IDictionary attrs = new Hashtable ();
			ArrayList attrValues = new ArrayList ();
			attrValues.Add (Encoding.BigEndianUnicode.GetBytes ("Friendly name"));
			attrs.Add (PKCS9.friendlyName, attrValues);

			p12.AddCertificate (x509, attrs);

			AssertEquals ("GA2.1", p12.Certificates.Count, 1);

			IDictionary pattrs = p12.GetAttributes (x509);

			Assert ("GA2.2", pattrs.Contains (PKCS9.friendlyName));
		}
Пример #2
0
        static RSA GetKeyMatchingCertificate(MSX.PKCS12 pfx, MSX.X509Certificate cert)
        {
            IDictionary attributes = pfx.GetAttributes(cert);

            return(pfx.GetAsymmetricAlgorithm(attributes) as RSA);
        }
Пример #3
0
		public void GetAttributes_Test1 ()
		{
			PKCS12 p12 = new PKCS12 ();

			IDictionary attrs = new Hashtable ();
			ArrayList attrValues = new ArrayList ();
			attrValues.Add (Encoding.BigEndianUnicode.GetBytes ("Friendly name"));
			attrs.Add (PKCS9.friendlyName, attrValues);

			AsymmetricAlgorithm aa = RSA.Create ();
			p12.AddKeyBag (aa, attrs);

			AssertEquals ("GA1.1", p12.Keys.Count, 1);

			IDictionary pattrs = p12.GetAttributes (aa);

			Assert ("GA1.2", pattrs.Contains (PKCS9.friendlyName));
		}