// Implements RopPassCallBack public RopPassCallBack.Ret PassCallBack(RopHandle ffi, object ctx, RopHandle key, RopHandle pgpCtx, RopHandle buf, int bufLen) { if (passProvider != null) { // create new Session and Key handlers RopSession ropSes = null; RopKey ropKey = null; try { if (own.TryGetTarget(out RopBind bind)) { ropSes = (!ffi.IsNull()? new RopSession(bind, ffi) : null); ropKey = (!key.IsNull()? new RopKey(bind, key) : null); SessionPassCallBack.Ret scbRet = passProvider.PassCallBack(ropSes, ctx, ropKey, RopHandle.Str(pgpCtx), bufLen); return(new RopPassCallBack.Ret(scbRet.ret, scbRet.outBuf)); } throw new RopError(RopBind.ROP_ERROR_INTERNAL); } catch (RopError) { } finally { if (ropSes != null) { ropSes.Detach(); } if (ropKey != null) { ropKey.Detach(); } } } return(new RopPassCallBack.Ret(false, null)); }
// Implements RopKeyCallBack public void KeyCallBack(RopHandle ffi, object ctx, RopHandle identifierType, RopHandle identifier, bool secret) { if (keyProvider != null) { // create a new Session handler RopSession ropSes = null; try { if (own.TryGetTarget(out RopBind bind)) { ropSes = (!ffi.IsNull()? new RopSession(bind, ffi) : null); keyProvider.KeyCallBack(ropSes, ctx, RopHandle.Str(identifierType), RopHandle.Str(identifier), secret); } throw new RopError(RopBind.ROP_ERROR_INTERNAL); } catch (RopError) { } finally { if (ropSes != null) { ropSes.Detach(); } } } }