Пример #1
0
        public static PROV_ENUMALGS [] GetProvAlgs(IntPtr prov)
        {
            ArrayList retAl = GetProvParam(prov, ProvParamEnum.ALGS, 52);
            ArrayList al    = new ArrayList();

            foreach (byte [] ba in retAl)
            {
                PROV_ENUMALGS pe = new PROV_ENUMALGS();
                pe.aiAlgid   = BitConverter.ToUInt32(ba, 0);
                pe.dwBitLen  = BitConverter.ToUInt32(ba, 4);
                pe.dwNameLen = BitConverter.ToUInt32(ba, 8);
                int nameLen = (int)(pe.dwNameLen * 2) - 1;                  //nullTerm
                if (nameLen > 0)
                {
                    pe.szName = Encoding.Unicode.GetString(ba, 12, nameLen);
                }
                if (pe.aiAlgid != 0)
                {
                    al.Add(pe);
                }
            }
            PROV_ENUMALGS [] pea = new PROV_ENUMALGS[al.Count];
            al.CopyTo(0, pea, 0, pea.Length);
            return(pea);
        }
Пример #2
0
		public static PROV_ENUMALGS [] GetProvAlgs(IntPtr prov)
		{
			ArrayList retAl = GetProvParam(prov, ProvParamEnum.ALGS, 52);
			ArrayList al = new ArrayList();
			foreach(byte [] ba in retAl)
			{
				PROV_ENUMALGS pe = new PROV_ENUMALGS();
				pe.aiAlgid = BitConverter.ToUInt32(ba, 0);
				pe.dwBitLen = BitConverter.ToUInt32(ba, 4);
				pe.dwNameLen = BitConverter.ToUInt32(ba, 8);
				int nameLen = (int) (pe.dwNameLen * 2) - 1; //nullTerm
				if(nameLen > 0)
					pe.szName = Encoding.Unicode.GetString(ba, 12, nameLen);
				if(pe.aiAlgid != 0)
					al.Add(pe);
			}
			PROV_ENUMALGS [] pea = new PROV_ENUMALGS[al.Count];
			al.CopyTo(0, pea, 0, pea.Length);
			return pea;
		}