Graph::SetPublicKeyForSignatureEncryption
Set a public key which is used to verify the digital signature of the *.so file to be loaded by the Matrix on the device side. This API must be called before the creation of a graph. This API is defined in graph.h.
The SHA256withRSA algorithm is used for digital signature. This component provides only the digital signature verification function. You need to sign the required SO file based on this algorithm. The signature file must be stored in the same directory as the SO file on the host side. The signature file name is "SO file name+.signature". For example, if the SO file name is libhosttodevice.so, the signature file name is libhosttodevice.so.signature.

If Graph::SetPublicKeyForSignatureEncryption is not called or its return value is not HIAI_OK, the public key cannot be set in the Matrix, and the signature verification mechanism will not be enabled on the device side. As a result, the *.so file that may be tampered cannot be identified by using the digital signature.
Syntax
static HIAI_StatusT Graph::SetPublicKeyForSignatureEncryption(const std::string& publicKey)
Parameter Description
Parameter |
Description |
Value Range |
---|---|---|
publicKey |
Public key required for digital signature verification |
- |
Return Value
For details about the returned error codes, see "Error Codes."
Error Codes
No. |
Error Code |
Description |
---|---|---|
1 |
HIAI_OK |
The running is OK. |
std::string publicKey = "-----BEGIN RSA PUBLIC KEY-----\n" "MIIBCAKCAQEAt+kdmu8CdViw2xHlh/JWXOl/0AitDgYGd+9RadULGZmj0tt/UQLv\n" "EYPZaXC8E0a9e97kqfg/ZHinu04XG5RhXv2J0kwkhuBAeCCllefvrQy5OBRqdLYq\n" "EZe8wUO0adSMDsLbPL52b+NdO9/zX+MUzvsBzitWJbiH96s4xCiEERX87/uQfr6F\n" "lHLtrNtooeF2VmxOm3n0yzh4kcSouLgb/O0+v0I+fnR+CTNG95IvzDNOYLWD6ZkL\n" "c7JyIYFZA0CNx9SlPhqbrfjOV5XSG3g3CW0TopUDfHyhAgZt5vACMpeDDx+89tg2\n" "RfT4M9DH/qKzkLlOURvsMShRMD6/PwzsPwIBAw==\n" "-----END RSA PUBLIC KEY-----"; auto ret = Graph::SetPublicKeyForSignatureEncryption(publicKey);
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot