[SOLVED] OPNSense API to import TLS Certificates

Started by ProximusAl, Today at 10:01:42 AM

Previous topic - Next topic
Today at 10:01:42 AM Last Edit: Today at 10:26:01 AM by ProximusAl
I'm trying to use the API to import a new TLS certificate for the WebGUI.

I keep getting:
HTTP 500
{"errorMessage":"Invalid private key provided: cannot parse private key data","errorTitle":"Certificate error"}

The certificate is an EC certificate that is accepted manually by the GUI, but is there something in the API that wont accept an EC private key?
e.g.: -----BEGIN EC PRIVATE KEY-----

I've got a feeling this will work with an RSA certificate, but as I don't have one, its hard to test.

TIA

Today at 10:25:44 AM #1 Last Edit: Today at 10:41:40 AM by ProximusAl
Ahhh, solved.  It was the \r \n formatting in the key.

Got it working now

$keyPem  = (Get-Content -Raw $PrivKeyPath)   -replace "`r`n","`n"