public delegate bool VerifyPeerCallback(VerifyPeerContext context)
Callback invoked with the expected targetHost and the peer's certificate.
If false is returned by this callback then it is treated as a
verification failure and the attempted connection will fail.
Invocation of the callback is blocking, so any
implementation should be light-weight.
Note that the callback can potentially be invoked multiple times,
concurrently from different threads (e.g. when multiple connections
are being created for the same credentials).
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[[["\u003cp\u003eThe \u003ccode\u003eVerifyPeerCallback\u003c/code\u003e delegate is invoked with a \u003ccode\u003eVerifyPeerContext\u003c/code\u003e to verify a peer's certificate and target host.\u003c/p\u003e\n"],["\u003cp\u003eReturning \u003ccode\u003efalse\u003c/code\u003e from the callback signifies a verification failure, causing the connection attempt to fail.\u003c/p\u003e\n"],["\u003cp\u003eThe callback's execution is blocking and should be lightweight, as it might be called multiple times concurrently from different threads.\u003c/p\u003e\n"],["\u003cp\u003eThe parameter of this callback is called \u003ccode\u003econtext\u003c/code\u003e, which is an object of type \u003ccode\u003eVerifyPeerContext\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe function returns a boolean, where \u003ccode\u003etrue\u003c/code\u003e means verification succeeded, and \u003ccode\u003efalse\u003c/code\u003e means it failed.\u003c/p\u003e\n"]]],[],null,["# Delegate VerifyPeerCallback (2.66.0)\n\nVersion latestkeyboard_arrow_down\n\n- [2.66.0 (latest)](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core.VerifyPeerCallback)\n- [2.63.0](/dotnet/docs/reference/Grpc.Core/2.63.0/Grpc.Core.VerifyPeerCallback)\n- [2.48.0](/dotnet/docs/reference/Grpc.Core/2.48.0/Grpc.Core.VerifyPeerCallback) \n\n public delegate bool VerifyPeerCallback(VerifyPeerContext context)\n\nCallback invoked with the expected targetHost and the peer's certificate.\nIf false is returned by this callback then it is treated as a\nverification failure and the attempted connection will fail.\nInvocation of the callback is blocking, so any\nimplementation should be light-weight.\nNote that the callback can potentially be invoked multiple times,\nconcurrently from different threads (e.g. when multiple connections\nare being created for the same credentials).\n\nNamespace\n---------\n\n[Grpc.Core](/dotnet/docs/reference/Grpc.Core/latest/Grpc.Core)\n\nAssembly\n--------\n\nGrpc.Core.Api.dll"]]