You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
my device is in internal network, and only through internal protocol gateway to access iot hub. every device has X509Certificate2 , how can i pass this X509Certificate2 to gateway ,then gateway act as proxy to use these X509Certificate2 to authen toward iot hub ?
protocol gateway default support sastoken, i used the following code, it work well, but i have choice to pass X509Certificate2 to protocol gateway ? i don't want to modify any device client relatived code, i want to let device client to keep transpent(regardless protocol gateway or iot hub)
i can pass certificate by willmessage in connectpacket, but i don't like this approch, anything else?
code as followed:
var x509Certificate = new X509Certificate2(@"E:\LLNC1AAA0EA001030.cer");
var buf = x509Certificate.GetRawCertData();
var setting = new MqttTransportSettings(TransportType.Mqtt_Tcp_Only);
setting.RemoteCertificateValidationCallback += (sender, cert, chain, error) => { return true; };
setting.HasWill = true;
setting.WillMessage = new WillMessage(QualityOfService.AtMostOnce, new Message(buf));
there's no good way to pass-through client certificate. Either use Hub-scoped credentials on the way to backend or if you can, store client certs locally on PG nodes for lookup/pull for forwarding.
my device is in internal network, and only through internal protocol gateway to access iot hub. every device has X509Certificate2 , how can i pass this X509Certificate2 to gateway ,then gateway act as proxy to use these X509Certificate2 to authen toward iot hub ?
protocol gateway default support sastoken, i used the following code, it work well, but i have choice to pass X509Certificate2 to protocol gateway ? i don't want to modify any device client relatived code, i want to let device client to keep transpent(regardless protocol gateway or iot hub)
sample code as followed:
private const string DeviceConnectionString = "GatewayHostName=127.0.0.1;HostName=xxx.azure-devices.cn;DeviceId=xxx;SharedAccessKey=xxx";
var x509Certificate = new X509Certificate2(@"E:\xxx.cer");
var setting = new MqttTransportSettings(TransportType.Mqtt_Tcp_Only);
setting.RemoteCertificateValidationCallback += (sender, cert, chain, error) => { return true; };
setting.ClientCertificate = x509Certificate;
var settings = new ITransportSettings[]
{
setting
};
deviceClient.OpenAsync();
deviceClient.SendEvent(...);
The text was updated successfully, but these errors were encountered: