Client Certificate Download Utility - cert2src

I have published a basic command line utility for downloading and exporting the chain root certificate required for TinyCLR OS to access secure sites. This eliminates the need to download them manually from a web browser.

Certificate can be exported in Security Certificate File Format (crt) commonly embedded as a binary project resource or source code added directly to a project as a byte array. Also, using build tasks this utility can be used to automate updating project certificates on build.

I wanted to share in case anyone else finds it useful. Here are a couple usage examples:

C:\project>cert2src.exe https://www.google.com --path

-----BEGIN CERTIFICATE-----
MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds

[Intentionally omitted]

hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
-----END CERTIFICATE-----

Root certificate successfully exported to 'C:\project\certificate.crt'
Root certificate downloaded from 'https://www.google.com/'
C:\project>cert2src.exe https://www.google.com --path --code --width 10

private static readonly byte[] Certificate =
{
     0x2d, 0x2d, 0x2d, 0x2d, 0x2d, 0x42, 0x45, 0x47, 0x49, 0x4e,
     0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41,

     [Intentionally omitted]

     0x2d, 0x2d, 0x2d, 0x2d, 0x45, 0x4e, 0x44, 0x20, 0x43, 0x45,
     0x2d, 0x2d, 0x2d, 0x2d, 0x0d, 0x0a
};

Root certificate successfully exported to 'C:\project\certificate.cs'
Root certificate downloaded from 'https://www.google.com/'
6 Likes