private void CertificatesInfoToUI(CertificatesDataContract.ReportedProperties certificatesInfo) { CertificateInfoToUI(certificatesInfo.rootCATrustedCertificates_CA, Reported_RootCATrustedCertificates_CA); CertificateInfoToUI(certificatesInfo.rootCATrustedCertificates_Root, Reported_RootCATrustedCertificates_Root); CertificateInfoToUI(certificatesInfo.rootCATrustedCertificates_TrustedPublisher, Reported_RootCATrustedCertificates_TrustedPublisher); CertificateInfoToUI(certificatesInfo.rootCATrustedCertificates_TrustedPeople, Reported_RootCATrustedCertificates_TrustedPeople); CertificateInfoToUI(certificatesInfo.certificateStore_CA_System, Reported_CertificateStore_CA_System); CertificateInfoToUI(certificatesInfo.certificateStore_Root_System, Reported_CertificateStore_Root_System); CertificateInfoToUI(certificatesInfo.certificateStore_My_User, Reported_CertificateStore_My_User); CertificateInfoToUI(certificatesInfo.certificateStore_My_System, Reported_CertificateStore_My_System); }
// IClientPropertyHandler public async Task <JObject> GetReportedPropertyAsync() { var request = new Message.GetCertificateConfigurationRequest(); var response = await _systemConfiguratorProxy.SendCommandAsync(request) as Message.GetCertificateConfigurationResponse; CertificatesDataContract.ReportedProperties reportedProperties = new CertificatesDataContract.ReportedProperties(); reportedProperties.Set(CertificatesDataContract.JsonRootCATrustedCertificates_Root, response.configuration.rootCATrustedCertificates_Root); reportedProperties.Set(CertificatesDataContract.JsonRootCATrustedCertificates_CA, response.configuration.rootCATrustedCertificates_CA); reportedProperties.Set(CertificatesDataContract.JsonRootCATrustedCertificates_TrustedPublisher, response.configuration.rootCATrustedCertificates_TrustedPublisher); reportedProperties.Set(CertificatesDataContract.JsonRootCATrustedCertificates_TrustedPeople, response.configuration.rootCATrustedCertificates_TrustedPeople); reportedProperties.Set(CertificatesDataContract.JsonCertificateStore_CA_System, response.configuration.certificateStore_CA_System); reportedProperties.Set(CertificatesDataContract.JsonCertificateStore_Root_System, response.configuration.certificateStore_Root_System); reportedProperties.Set(CertificatesDataContract.JsonCertificateStore_My_User, response.configuration.certificateStore_My_User); reportedProperties.Set(CertificatesDataContract.JsonCertificateStore_My_System, response.configuration.certificateStore_My_System); return(reportedProperties.ToJsonObject()); }
/// <summary> /// Retrieve all certificates on device from device twin. /// </summary> private async void ListCertificateButton_ClickAsync(object sender, RoutedEventArgs e) { var twinResult = await _mainPage.GetTwinData(CertificatesDataContract.SectionName); if (twinResult != null) { CertificatesDataContract.ReportedProperties reportedProperties = CertificatesDataContract.ReportedProperties.FromJsonObject((JObject)twinResult); CertificateInfoToUI(reportedProperties.rootCATrustedCertificates_CA, "./Device/Vendor/MSFT/RootCATrustedCertificates/CA ", CertificateStore.rootCATrustedCertificates_CA, CACertsListView); CertificateInfoToUI(reportedProperties.rootCATrustedCertificates_Root, "./Device/Vendor/MSFT/RootCATrustedCertificates/Root", CertificateStore.rootCATrustedCertificates_Root, RootCertsListView); CertificateInfoToUI(reportedProperties.rootCATrustedCertificates_TrustedPublisher, "./Device/Vendor/MSFT/RootCATrustedCertificates/TrustedPublisher", CertificateStore.rootCATrustedCertificates_TrustedPublisher, TrustedPublisherCertsListView); CertificateInfoToUI(reportedProperties.rootCATrustedCertificates_TrustedPeople, "./Device/Vendor/MSFT/RootCATrustedCertificates/TrustedPeople", CertificateStore.rootCATrustedCertificates_TrustedPeople, TrustedPeopleCertsListView); CertificateInfoToUI(reportedProperties.certificateStore_CA_System, "./Vendor/MSFT/CertificateStore/CA/System", CertificateStore.certificateStore_CA_System, CASysCertsListView); CertificateInfoToUI(reportedProperties.certificateStore_Root_System, "./Vendor/MSFT/CertificateStore/Root/System", CertificateStore.certificateStore_Root_System, RootSysCertsListView); CertificateInfoToUI(reportedProperties.certificateStore_My_User, "./Vendor/MSFT/CertificateStore/My/User", CertificateStore.certificateStore_My_User, MyUserCertsListView); CertificateInfoToUI(reportedProperties.certificateStore_My_System, "./Vendor/MSFT/CertificateStore/My/System", CertificateStore.certificateStore_My_System, MySysCertsListView); } }