private IToken GetToken(UInt32 slotID) { ISlot slot = GetSlot(slotID); if (!slot.HasToken) { throw new Pkcs11Exception("Get token faild!", Rv.DEVICE_REMOVED); } Task <IToken> task = slot.GetToken(); if (task.Exception != null) { throw new Pkcs11Exception("Get token faild!", Rv.DEVICE_ERROR); } return(task.Result); }
public async Task <IToken> GetToken(ISlot slot) { return(await slot.GetToken()); }