Skip to main content

Certificate

warning

This API is not documented yet.

Overview​

Synology DSM Core Certificate API Wrapper.

This class provides methods to interact with the Synology DSM Core Certificate API, allowing management of SSL certificates on a Synology NAS.

Parameters​

ip_address : str IP address or hostname of the Synology NAS. port : str Port number to connect to. username : str Username for authentication. password : str Password for authentication. secure : bool, optional Use HTTPS if True, HTTP if False (default is False). cert_verify : bool, optional Verify SSL certificates (default is False). dsm_version : int, optional DSM version (default is 7). debug : bool, optional Enable debug output (default is True). otp_code : Optional[str], optional One-time password for 2FA (default is None).

Methods​

list_cert​

List all certificates.

Internal API​

SYNO.Core.Certificate

Returns​

dict[str, object]
List of certificates.


set_default_cert​

Set a certificate as the default.

Internal API​

SYNO.Core.Certificate

Parameters​

cert_id str
Certificate ID to set as default.

Returns​

dict[str, object]
API response.


delete_certificate​

Delete one or more certificates.

Internal API​

SYNO.Core.Certificate

Parameters​

ids str or list[str]
Certificate ID or list of IDs to delete.

Returns​

dict[str, object]
API response.


upload_cert​

Upload a certificate to the Synology NAS.

Internal API​

SYNO.Core.Certificate

Parameters​

serv_key str
Path to the server key file (default is "server.key").

ser_cert str
Path to the server certificate file (default is "server.crt").

ca_cert Optional[str]
Path to the CA certificate file (default is None).

set_as_default bool
Set as default certificate after upload (default is True).

cert_id Optional[str]
Certificate ID to update (default is None).

desc Optional[str]
Description for the certificate (default is None).

Returns​

tuple[int, dict[str, object]]
HTTP status code and API response.


set_certificate_for_service​

Set a certificate for a specific DSM service.

Internal API​

SYNO.Core.Certificate.Service

Parameters​

cert_id str
Certificate ID to assign.

service_name str
Name of the service (default is "DSM Desktop Service").

Returns​

tuple[int, dict[str, object]]
HTTP status code and API response.


export_cert​

Export a certificate from the Synology NAS.

Internal API​

SYNO.Core.Certificate

Parameters​

cert_id str
The certificate ID to export. This can be found in the list_cert() method.

Returns​

Optional[BytesIO]
A BytesIO object containing the certificate archive, or None if export fails.