Today, let’s take a look at the private_key_jwt authentication mode:
- Create an RSA Key Pair
<CreateRSAKeyPair xmlns="http://www.onvif.org/ver10/advancedsecurity/wsdl">
<KeyLength>3072</KeyLength>
</CreateRSAKeyPair>
- Create a CSR (Certificate Signing Request)
<CreatePKCS10CSR xmlns="http://www.onvif.org/ver10/advancedsecurity/wsdl">
<Subject>
<Country>xx</Country>
<CommonName>10.168.1.180</CommonName>
</Subject>
<KeyID>Key-a2f3ddd4-79db-4edb-97fe-dc7f2b3ff6e1</KeyID>
<SignatureAlgorithm>
<algorithm>1.2.840</algorithm>
<parameters />
</SignatureAlgorithm>
</CreatePKCS10CSR>
- Upload the Device Certificate (This certificate needs to be stored on the server side)
<UploadCertificate xmlns="http://www.onvif.org/ver10/advancedsecurity/wsdl">
<Certificate>MIIBlTCCA...</Certificate>
<Alias>A</Alias>
<PrivateKeyRequired>false</PrivateKeyRequired>
</UploadCertificate>
- Create a Policy for the Authorization Server
<CreateCertPathValidationPolicy xmlns="http://www.onvif.org/ver10/advancedsecurity/wsdl">
<Alias>Test CertPathValidationPolicy AuthServer Alias</Alias>
<Parameters>
<UseDeltaCRLs>true</UseDeltaCRLs>
</Parameters>
<TrustAnchor>
<CertificateID>Cert-0b1cb156-3522-4522-b70a-17924cc893ef</CertificateID>
</TrustAnchor>
</CreateCertPathValidationPolicy>
- Configure the Authorization Server (Type: private_key_jwt, used by the server to verify the legitimacy of the device)
<CreateAuthorizationServerConfiguration xmlns="http://www.onvif.org/ver10/advancedsecurity/wsdl">
<Configuration Type="OAuthClientCredentials" ClientAuth="private_key_jwt">
<ServerUri>https://10.168.1.195:55032/.well-known/openid-configuration</ServerUri>
<ClientID>c1</ClientID>
<Scope>s1</Scope>
<KeyID>Key-a2f3ddd4-79db-4edb-97fe-dc7f2b3ff6e1</KeyID>
<CertPathValidationPolicyID>Policy-3221bf30-e0bf-4454-904e-80b89084f2a5</CertPathValidationPolicyID>
</Configuration>
</CreateAuthorizationServerConfiguration>
- Upload the Uplink Server Certificate
<UploadCertificate xmlns="http://www.onvif.org/ver10/advancedsecurity/wsdl">
<Certificate>MIIBizCCATKgAwIBA...</Certificate>
<Alias>Server 1</Alias>
<PrivateKeyRequired>false</PrivateKeyRequired>
</UploadCertificate>
- Configure the Server Certificate Policy (Used to verify the legitimacy of the server and prevent Man-in-the-Middle attacks)
<CreateCertPathValidationPolicy xmlns="http://www.onvif.org/ver10/advancedsecurity/wsdl">
<Alias>Test CertPathValidationPolicy Uplink Alias</Alias>
<Parameters>
<UseDeltaCRLs>true</UseDeltaCRLs>
</Parameters>
<TrustAnchor>
<CertificateID>Cert-5be5f78b-6262-4824-bc0a-e4c4314b8ed1</CertificateID>
</TrustAnchor>
</CreateCertPathValidationPolicy>
- Configure Uplink Parameters
<SetUplink xmlns="http://www.onvif.org/ver10/uplink/wsdl">
<Configuration>
<RemoteAddress>wss://10.168.1.195:55051</RemoteAddress>
<UserLevel>Administrator</UserLevel>
<CertPathValidationPolicyID>Policy-b74fdf84-3661-4bec-8065-881cfed02bf1</CertPathValidationPolicyID>
<AuthorizationServer>AuthSrv-21f1de03-14c2-46a5-9059-a9607bcdf310</AuthorizationServer>
</Configuration>
</SetUplink>
