Net.Pkcs11Interop.HighLevelAPI81.Session.FindObjects C# (CSharp) Method

FindObjects() public method

Continues a search for token and session objects that match a template, obtaining additional object handles
public FindObjects ( int objectCount ) : List
objectCount int Maximum number of object handles to be returned
return List
        public List<ObjectHandle> FindObjects(int objectCount)
        {
            if (this._disposed)
                throw new ObjectDisposedException(this.GetType().FullName);

            List<ObjectHandle> foundObjects = new List<ObjectHandle>();

            ulong[] objects = new ulong[objectCount];
            ulong foundObjectsCount = 0;
            CKR rv = _p11.C_FindObjects(_sessionId, objects, Convert.ToUInt64(objectCount), ref foundObjectsCount);
            if (rv != CKR.CKR_OK)
                throw new Pkcs11Exception("C_FindObjects", rv);

            for (int i = 0; i < Convert.ToInt32(foundObjectsCount); i++)
                foundObjects.Add(new ObjectHandle(objects[i]));

            return foundObjects;
        }