ionic-team / vscode-ionic

Visual Studio Code Ionic Extension
Other
10 stars 1 forks source link

Error on openssl when activating "Use HTTPS" in settings #147

Open Gfoulon opened 1 year ago

Gfoulon commented 1 year ago

When I try to activate "Use HTTPS" in settings on IONIC VSCode extension (v1.44.1 - under Windows11 - OPENSSL version 3.10), I've got the following error message on OUTPUT:

[Ionic] Installing @jcesarmobile/ssl-skip
[Ionic] openssl genrsa -out ca.key 4096
[Ionic] openssl req -config 'c:\Users\gfoul\AppData\Roaming\Code\User\globalStorage\ionic.ionic\cr-ca.txt' -key ca.key -new -x509 -days 3650 -sha256 -out ca.crt
[error] Can't open **"'c:\Users\gfoul\AppData\Roaming\Code\User\globalStorage\ionic.ionic\cr-ca.txt'"** for reading, Invalid argument
5CF30000:error:8000007B:system library:BIO_new_file:no protocol option:crypto\bio\bss_file.c:67:calling fopen('c:\Users\gfoul\AppData\Roaming\Code\User\globalStorage\ionic.ionic\cr-ca.txt', r)
5CF30000:error:10080002:BIO routines:BIO_new_file:system lib:crypto\bio\bss_file.c:77:

[error] Can't open "'c:\Users\gfoul\AppData\Roaming\Code\User\globalStorage\ionic.ionic\cr-ca.txt'" for reading, Invalid argument
5CF30000:error:8000007B:system library:BIO_new_file:no protocol option:crypto\bio\bss_file.c:67:calling fopen('c:\Users\gfoul\AppData\Roaming\Code\User\globalStorage\ionic.ionic\cr-ca.txt', r)
5CF30000:error:10080002:BIO routines:BIO_new_file:system lib:crypto\bio\bss_file.c:77:

Look like it add ' (quote) on filename instead of " (double-quote) but I don't know how to solve this issue. My goal is to be able to use Nexus browser on devices to test camera usage (which need HTTPS so SSL).

Thank you for your help.

dtarnawsky commented 1 year ago

Hey @Gfoulon,

The option to Use HTTPS on Windows isn't supported yet (triggers the error you found). On a Mac it uses openssl to create a root Certificate Authority and create a signed certificate for the server. There's a bit of work needed to get the same functionality working on a Windows machine. It's on the roadmap as an outstanding issue and this issue will stay open until it is addressed.

Gfoulon commented 1 year ago

Ok, thank for your quick feedback. I tried on a Mac but when opening the app I've got an error "[error][console] {"message":"The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.14.34” which could put your confidential information at risk.","code":"NSURLErrorDomain","errorMessage":"The certificate for this server is invalid. You might be connecting to a server that is pretending to be “192.168.14.34” which could put your confidential information at risk."}" both on the VSCode output console and also on an alert panel on the device.

I have downloaded and installed the cetificate on the device (trough Chrome donwload on the mac then export) but still same issue with the local certificate.

I don't quite understand why this wouldn't work on Windows because except for the error on the path between quotes, the rest of the process seems to work. The same command with double-quotes instead of quotes works in terminal (but I don't know where to placed the generated certificate).

Thank you

cloopadoop commented 1 month ago

@Gfoulon If you have git installed on Windows, add its bin directory to your path variable and the error should be resolved, as the openssl executable it has seems to work :)