question

MareksMalnas-5534 avatar image
0 Votes"
MareksMalnas-5534 asked MareksMalnas-5534 answered

LaunchFileAsync and CRT (certificate) file extension

Is there an option to let user see (eg open) what's inside CRT file by using winrt::Windows::System::Launcher::LaunchFileAsync() API in Windows store app? App is reading certificate (DER encoded) from the server, storing it into a temporary file using winrt::Windows::Storage::FileIO API (into winrt::Windows::Storage::ApplicationData::Current().TemporaryFolder(). At present LaunchFileAsync is getting access denied error. Only workaround I've found is to use winrt::Windows::System::Launcher::LaunchFolderAsync() to show that folder to user and let It double click on that crt file. It would be nice to let LaunchFileAsync open certificate view window instead.

windows-uwp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AryaDing-MSFT avatar image
0 Votes"
AryaDing-MSFT answered AryaDing-MSFT commented

Hi,

Welcome to MicroSoft Q&A!

To solved the access denied issue, you could use StorageFile.GetFileFromApplicationUriAsync(Uri) method to get the file. As follows:

    private async void Button_Click(object sender, RoutedEventArgs e)
     {           
         var file = await StorageFile.GetFileFromApplicationUriAsync(new Uri("ms-appdata:///temp/mycrt.crt"));
           
     }


Note that LaunchFileAsync API also imposes several restrictions on what types of files it can launch. Many file types that contain executable code, for example .exe, .msi, and .js files, are blocked from launching. Maybe the certification file can't be launched.

Updated:

I have checked the related properties about Launcher, I have to say that there is no such launcher properties and app permission setting that could launch built-in certificate viewer to open this certification.





If the response is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.







· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Unfortunately that doesn't help. LaunchFileAsync() returns 0/false. If I change file extension to txt - Notepad is opened, but, of course, Notepad can't display CRT/certificate file content. LaunchFileAsync works fine for txt, doc, pdf, xls and a couple of other files. I'd need to to display the certificate information for me.

0 Votes 0 ·

I wonder is this:

"This API also imposes several restrictions on what types of files it can launch. Many file types that contain executable code, for example .exe, .msi, and .js files, are blocked from launching"

could be somehow extended (launcher properties, app permission settings, etc.) to allow it to launch Windows builtin certificate viewer.

0 Votes 0 ·

@MareksMalnas-5534 I have checked the related properties about Launcher, I have to say that there is no such launcher properties and app permission setting that could launch built-in certificate viewer to open this certification.

0 Votes 0 ·
MareksMalnas-5534 avatar image
0 Votes"
MareksMalnas-5534 answered

Unfortunately as there is no winrt api to let me show certificate content to the user or launch Windows builtin certificate viewer there is no answer to mark. We can close this subject.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.