ONVIF中KeyId/CertId/CertPathId及PassPhraseId的定义与创建方法问询
Great question—these identifiers are foundational to ONVIF's secure certificate and key management, which keeps device communication encrypted and authenticated. Let’s break down each one with clear definitions and how they’re typically created:
KeyId
What it is: A unique identifier for an asymmetric encryption key pair (public/private key) stored on an ONVIF device. It links keys to certificates, access control policies, or encryption operations like signing messages or decrypting data.
How it’s created:
- Most commonly, the device auto-generates a
KeyIdwhen you create a key pair via the ONVIFCertificateManagementservice’sCreateKeyPaircommand. This is usually a UUID or a hash of the public key (SHA-1 or SHA-256) for guaranteed uniqueness. - Some devices let you specify a custom
KeyIdduring key creation, as long as it’s unique within the device’s key store. - If importing an existing key pair, the device may assign a new
KeyIdor let you reuse an existing identifier (depending on device support).
CertId
What it is: A unique identifier for a digital certificate (device certificate, CA certificate, etc.) stored in the device’s certificate repository. It’s used to reference specific certificates for authentication, encryption, or trust chain configuration.
How it’s created:
- When generating a self-signed certificate via
CreateCertificateor importing a certificate viaImportCertificate, the device automatically generates aCertId—usually a UUID, or a hash of the certificate’s serial number and subject DN. - Some devices allow you to define a custom
CertIdduring import/generation, as long as it doesn’t conflict with existing entries. - You can retrieve existing
CertIds using theGetCertificatescommand to list all stored certificates and their identifiers.
CertPathId
What it is: A unique identifier for a certificate path (trust chain) on the device. A certificate path includes the end-entity certificate plus all intermediate CA certificates and the root CA certificate needed to validate the end-entity certificate’s authenticity.
How it’s created:
- When assembling a trust chain (e.g., importing a root CA and intermediate CA, then linking them to a device certificate), the device generates a
CertPathIdvia theAddCertPathcommand. This is typically a UUID or a hash of all certificates in the chain combined. - The
CertPathIdlets the device quickly reference the full trust chain when validating incoming connections or signing outgoing requests. - You can list existing certificate paths with
GetCertPathsto retrieve theirCertPathIds.
PassPhraseId
What it is: A unique identifier for a stored passphrase (password) used to encrypt sensitive data like private keys. Instead of passing plaintext passphrases in API commands, you use this ID to reference the encrypted passphrase stored on the device.
How it’s created:
- You create a
PassPhraseIdby using theSetPassPhrasecommand in theCertificateManagementservice. The device encrypts the passphrase and assigns a unique ID (usually a UUID) to it. - When you need to use the passphrase (e.g., exporting a private key with
ExportPrivateKey), you specify thePassPhraseIdinstead of the plaintext password. - Some devices let you overwrite existing
PassPhraseIds or delete them withDeletePassPhrase.
内容的提问来源于stack exchange,提问作者krishnaj76




