아래 명령을 사용하고 있습니다
curl --insecure --cert 'cert.p12:password' -X GET https://serverUrl -H 'Content-Type: application/json'
curl --insecure --cert-type P12 --cert 'cert.p12:password' -X GET https://serverUrl -H 'Content-Type: application/json'
Ubuntu 16.04.4 LTS \n \l(AWS Lightsail)에서는 작동하지 않으며 아래 오류가 발생합니다.
컬: (35) X.509 잠재적으로 암호화된 키 파일을 읽는 중 오류가 발생했습니다. 구문 분석 중 오류가 발생했습니다.
하지만 Ubuntu 18.04.3 LTS에서 작업 중 \n \l (로컬 시스템)
답변1
Ubuntu 16.04.4에서는 LTS P12 파일이 지원되지 않으므로 아래 명령을 사용할 수 있습니다.
PKCS#1 개인 키
openssl pkcs12 -in cert.p12 -nocerts -out privateKey.pem
인증서:
openssl pkcs12 -in cert.p12 -clcerts -nokeys -out publicCert.pem
아래 명령을 사용하여 API를 호출할 수 있습니다.
curl -k --cert ./publicCert.pem --cert-type PEM --key ./privateKey.pem --key-type PEM --pass password -X GET https://serverUrl -H 'Content-Type: application/json'